|
KiCad PCB EDA Suite
|
Translates KiCad board geometry to and from the planegcs solver (issue #2329). More...
#include <board_constraint_adapter.h>
Classes | |
| struct | ANCHOR_PARAMS |
| Param indices of an anchor coordinates a rect corner aliases mixed start end params so y is not always x plus 1. More... | |
| struct | RIGID_FOOTPRINT |
| A footprint moving as one body with its translation from buildPosition held in the params at translationX. More... | |
| struct | RIGID_RADIUS_HOLD |
| struct | RIGID_STATE |
| struct | SHAPE_VARS |
| Per-shape indices into m_params. More... | |
Public Types | |
| using | SNAPSHOT = CONSTRAINT_SYSTEM_2D::SNAPSHOT |
Public Member Functions | |
| BOARD_CONSTRAINT_ADAPTER () | |
| ~BOARD_CONSTRAINT_ADAPTER () | |
| BOARD_CONSTRAINT_ADAPTER (const BOARD_CONSTRAINT_ADAPTER &)=delete | |
| BOARD_CONSTRAINT_ADAPTER & | operator= (const BOARD_CONSTRAINT_ADAPTER &)=delete |
| bool | Build (const std::vector< PCB_SHAPE * > &aShapes, const std::vector< PCB_CONSTRAINT * > &aConstraints, const std::set< KIID > *aFixedShapes=nullptr, const std::vector< PCB_DIMENSION_BASE * > &aDimensions={}, const std::vector< PAD * > &aPads={}) |
| Translate a cluster into a planegcs system. | |
| const std::vector< KIID > & | UnmappedConstraints () const |
| Constraints from the last Build() that could not be mapped onto a solver primitive (wrong member count/kind for their type, e.g. | |
| bool | Solve (const CONSTRAINT_MEMBER &aDragged, const VECTOR2I &aCursor, bool aStabilize=false, const std::set< KIID > &aEdited={}, const std::optional< std::pair< CONSTRAINT_MEMBER, VECTOR2I > > &aCoDragged=std::nullopt, bool aHoldDraggedRigid=false) |
| Solve the system, pinning a dragged anchor to a cursor position. | |
| bool | SolveSnapRelations (const CONSTRAINT_MEMBER &aDragged, const std::vector< SNAP_CANDIDATE > &aCandidates, const VECTOR2I &aCursor) |
| bool | SolveRigidTranslation (const std::set< KIID > &aEditedShapes, const VECTOR2I &aTranslation) |
| CONSTRAINT_BLOCK_RESULT | SolveBlockEdit (const std::vector< std::pair< CONSTRAINT_MEMBER, VECTOR2I > > &aPinnedAnchors, const std::set< KIID > &aTranslatedShapes, const VECTOR2I &aTranslation) |
| Solve a block edit whose geometry the caller has already written. | |
| bool | TravelsWhole (const std::set< KIID > &aEditedShapes) const |
True when every shape in the cluster is in aEditedShapes and free to travel with it. | |
| bool | SolveRigidSnapRelations (const std::set< KIID > &aEditedShapes, const VECTOR2I &aReference, const std::vector< SNAP_CANDIDATE > &aCandidates, const VECTOR2I &aCursor, VECTOR2I &aResolvedCursor) |
| bool | Solve (bool aStabilize=false) |
Solve with no drag pin. aStabilize holds free segment lengths (see the dragged overload). | |
| bool | SolveAfterResize (const KIID &aResizedShape) |
| Solve after a resize. | |
| std::vector< PCB_SHAPE * > | Apply (const std::function< void(BOARD_ITEM *)> &aBeforeWrite={}) |
| Write the solved coordinates back into the shapes, de-normalized to IU. | |
| void | ApplyReferenceValues (const std::function< void(BOARD_ITEM *)> &aBeforeWrite={}) |
| Propagate solved reference (non-driving) constraint values back into their m_value so a reference dimension tracks the geometry it measures. | |
| CONSTRAINT_DIAGNOSIS | Diagnose () |
| Report degrees of freedom and conflicting/redundant constraints. | |
| SNAPSHOT | Snapshot () const |
| bool | Restore (const SNAPSHOT &aSnapshot) |
| std::optional< VECTOR2I > | AnchorPosition (const CONSTRAINT_MEMBER &aMember) const |
| bool | QuantizedRelationsSatisfied () |
| bool | CurrentRelationsSatisfied () const |
| int | DropStaleRelations () |
| Remove the constraints the current geometry already fails to satisfy. | |
Private Types | |
| enum class | SHAPE_KIND { SEGMENT , BEZIER , CIRCLE , ARC , ELLIPSE , ELLIPSE_ARC , POINT_PAIR , RECTANGLE , POLYGON , PAD_CENTER } |
Private Member Functions | |
| void | coupleRigidFootprints (const std::set< FOOTPRINT * > &aFootprints, const std::set< KIID > *aFixedShapes, std::set< int > &aFixed) |
Tie every mapped child of each footprint in aFootprints to one shared translation, or freeze them all when any is locked or in aFixedShapes, adding frozen params to aFixed. | |
| int | pushParam (double aValue) |
| Append a normalized coordinate to the backing store, returning its stable index. | |
| int | temporaryParam (double aValue) |
| void | beginTemporaryParameters () |
| bool | addSnapRelations (const ANCHOR_PARAMS &aAnchor, const std::vector< SNAP_CANDIDATE > &aCandidates, const VECTOR2I &aOffset) |
| RIGID_STATE | collectRigidState (const std::set< KIID > &aEditedShapes) const |
| void | holdRigidRadii (const std::vector< RIGID_RADIUS_HOLD > &aRadii, int aTag) |
| void | recordReferenceValue (PCB_CONSTRAINT *aConstraint) |
| Note a non-driving valued constraint so its measured value can be read back after a solve. | |
| void | holdFreeSegmentLengths (int aTag, const std::set< KIID > &aShapes) |
Length hold on the free segments in aShapes tagged aTag so only those shapes are protected while a merely dragged-along neighbour keeps its own stay-put pins instead. | |
| void | holdFreeArcRadii (int aTag, const std::set< KIID > &aShapes) |
Radius hold on the free arcs in aShapes tagged aTag so an angle change rotates an endpoint instead of collapsing the arc a real FIXED_RADIUS still wins. | |
| void | holdShapesRigid (int aTag, const std::set< KIID > &aShapes) |
Hold the shapes in aShapes rigid, tagged aTag, so a shape the solve moves translates instead of stretching. | |
| void | holdArcRadius (const SHAPE_VARS &aVars, int aTag) |
Hold aVars's arc at its current radius (tagged aTag). | |
| void | softPinPoint (const ANCHOR_PARAMS &aPoint, int aTag, std::optional< double > aWeight=std::nullopt) |
Pin the point at aPoint where it sits tagged aTag with aWeight rescaling the tier or the default weight overriding the stay-put tier when unset an invalid point is ignored. | |
| void | softPinPoint (int aPointX, int aTag, std::optional< double > aWeight=std::nullopt) |
As above for the point whose x param is aPointX and whose y param follows it. | |
| void | softPinCoordinate (int aParam, int aTag, std::optional< double > aWeight=std::nullopt) |
Hold the one coordinate at aParam where it sits, tagged aTag, with aWeight scaling the tier. | |
| void | pinUncommandedCoordinates (const std::set< int > &aCommanded, int aTag) |
Weakly hold every cluster coordinate outside aCommanded where it sits, tagged aTag, so nothing the caller left alone moves further than the constraints force. | |
| void | holdPolygonVertices (const std::set< KIID > &aShapes, int aTag) |
Soft-pin every vertex of each POLYGON in aShapes tagged aTag for edited shapes pinUneditedShapes excludes so unbound vertices keep their null-space minimal-movement pins. | |
| void | pinDraggedShapeRest (const CONSTRAINT_MEMBER &aDragged, int aTag, const CONSTRAINT_MEMBER *aCoDragged=nullptr) |
Hold the parts of the dragged shape meant to stay put tagged aTag a segment holds its far endpoint an arc holds centre radius and far endpoint or both endpoints on a centre drag. | |
| void | pinUneditedShapes (const std::set< KIID > &aEdited, int aTag) |
Soft-pin every cluster shape not in aEdited at its current geometry tagged aTag for a minimal-movement solve aEdited must list every edited shape or a neighbour gets held back. | |
| bool | solveSucceeded (int aSolveResult) |
| Decide whether a solve reached a usable result a raw Success or Converged qualifies while a Failed code is accepted only when every driving hard constraint is still satisfied A state with a non-finite parameter never qualifies, so it can never be written to the board. | |
| bool | hardRelationsSatisfied () const |
| bool | parametersFinite () const |
| std::vector< int > | staleRelationTags () const |
| Driving constraint tags whose residual is already out of tolerance, ignoring dropped ones. | |
| ANCHOR_PARAMS | anchorParams (const CONSTRAINT_MEMBER &aMember) const |
| Indices into m_params of the coordinates an anchor maps to invalid if the shape has no such anchor for example a circle has no endpoints. | |
| PCB_DIM_ORTHOGONAL * | orthogonalDimensionForMembers (const std::vector< CONSTRAINT_MEMBER > &aMembers) const |
| The orthogonal dimension a two-point length constraint drives or nullptr requires both members to be the same dimension START and END in either order. | |
| double | normalizeX (int aIU) const |
| IU <-> normalized (millimetre, cluster-centred) frame, per axis. | |
| double | normalizeY (int aIU) const |
| double | denormalizeX (double aNorm) const |
| double | denormalizeY (double aNorm) const |
Static Private Member Functions | |
| static BOARD_ITEM * | itemOf (const SHAPE_VARS &aVars) |
Private Attributes | |
| CONSTRAINT_SYSTEM_2D | m_system |
| GCS::System * | m_gcs |
| std::deque< double > & | m_params |
| std::map< KIID, SHAPE_VARS > | m_shapeVars |
| std::set< int > | m_fixedParams |
| Parameter indices the solver may not move, so a rigid translation may not either. | |
| std::set< int > | m_groundedPositionParams |
| The subset of those grounded by a FIXED_POSITION constraint rather than by a lock or a driving constant, which a block edit may not command to a new place. | |
| std::map< int, KIID > | m_tagToConstraint |
| std::set< int > | m_droppedTags |
| Stale relations taken out of the system. | |
| std::set< int > | m_nonDrivingTags |
| Measurement-only; excluded from conflict residuals. | |
| std::map< int, std::vector< KIID > > | m_tagMembers |
| Member items per tag, for collapse attribution. | |
| std::vector< PCB_CONSTRAINT * > | m_referenceConstraints |
| Non-driving valued, read back after a solve. | |
| std::vector< KIID > | m_unmapped |
| Constraints Build() could not map (not enforced). | |
| std::vector< RIGID_FOOTPRINT > | m_rigidFootprints |
| std::set< KIID > | m_rigidMembers |
| Mapped items that move only with their footprint. | |
| std::set< KIID > | m_angleConstrainedShapes |
| Shapes a direction or angle constraint could collapse to a point only these get a stabilize length or radius hold. | |
| double | m_scale = 1.0 |
| IU per normalized unit. | |
| double | m_invScale = 1.0 |
| 1 / m_scale. | |
| int | m_dragTargetX = -1 |
| Stable backing slot for the drag pin's x target (-1 = unset). | |
| int | m_dragTargetY = -1 |
| Stable backing slot for the drag pin's y target. | |
| int | m_coDragTargetX = -1 |
| Backing slot for the co-dragged pin x target. | |
| int | m_coDragTargetY = -1 |
| Backing slot for the co-dragged pin y target. | |
| std::vector< int > | m_temporaryParams |
| size_t | m_nextTemporaryParam = 0 |
| int | m_lengthHoldTag = -1 |
| int | m_resizeRadiusTag = -1 |
| bool | m_built = false |
Translates KiCad board geometry to and from the planegcs solver (issue #2329).
Build() translates a cluster of PCB_SHAPE objects and the PCB_CONSTRAINT objects among them into a planegcs system, scaled into a millimetre frame because raw IU (nanometres) squared in the residuals is badly conditioned. Solve() runs the solver (optionally pinning a dragged anchor to a cursor position), Apply() writes the solution back to the shapes in IU, and Diagnose() reports the constraint state.
CONSTRAINT_SYSTEM_2D owns the normalized coordinate frame, planegcs system, and pointer-stable parameter storage. This adapter maps board geometry and authored constraints into that shared solver-neutral lifetime.
Definition at line 118 of file board_constraint_adapter.h.
Definition at line 247 of file board_constraint_adapter.h.
|
strongprivate |
| Enumerator | |
|---|---|
| SEGMENT | |
| BEZIER | A cubic bezier only its start and end endpoints are exposed as free points. |
| CIRCLE | |
| ARC | |
| ELLIPSE | |
| ELLIPSE_ARC | |
| POINT_PAIR | A dimension's two feature points (start + end); no line/curve geometry. |
| RECTANGLE | An axis-aligned rectangle whose four corners alias the two stored corners params so rectness holds by construction with no extra DOF. |
| POLYGON | A single hole-free outline with one free param pair per vertex since write-back rebuilds one outline only. |
| PAD_CENTER | A pad's centre point, which only ever moves with its footprint. |
Definition at line 265 of file board_constraint_adapter.h.
| BOARD_CONSTRAINT_ADAPTER::BOARD_CONSTRAINT_ADAPTER | ( | ) |
Definition at line 386 of file board_constraint_adapter.cpp.
References m_gcs, m_params, and m_system.
Referenced by BOARD_CONSTRAINT_ADAPTER(), and operator=().
| BOARD_CONSTRAINT_ADAPTER::~BOARD_CONSTRAINT_ADAPTER | ( | ) |
Definition at line 393 of file board_constraint_adapter.cpp.
|
delete |
References BOARD_CONSTRAINT_ADAPTER().
|
private |
Definition at line 1849 of file board_constraint_adapter.cpp.
References anchor, ANGLE, BBOX_ALIGNMENT, BBOX_EQUAL_GAP, center, CIRCLE, circle(), COINCIDENCE, GRID_X, GRID_Y, KiROUND(), m_gcs, m_invScale, m_params, NORMAL, normalizeX(), normalizeY(), POINT_ON_ARC, POINT_ON_CIRCLE, POINT_ON_LINE, POINT_ON_RAY, POINT_ON_SEGMENT, radius, TANGENT, temporaryParam(), BOARD_CONSTRAINT_ADAPTER::ANCHOR_PARAMS::x, VECTOR2< T >::x, X_COORDINATE, BOARD_CONSTRAINT_ADAPTER::ANCHOR_PARAMS::y, VECTOR2< T >::y, and Y_COORDINATE.
Referenced by SolveRigidSnapRelations(), and SolveSnapRelations().
|
private |
Indices into m_params of the coordinates an anchor maps to invalid if the shape has no such anchor for example a circle has no endpoints.
Definition at line 542 of file board_constraint_adapter.cpp.
References ARC, BOARD_CONSTRAINT_ADAPTER::SHAPE_VARS::arcEndX, BOARD_CONSTRAINT_ADAPTER::SHAPE_VARS::arcStartX, BEZIER, CENTER, ELLIPSE_ARC, END, BOARD_CONSTRAINT_ADAPTER::SHAPE_VARS::endX, BOARD_CONSTRAINT_ADAPTER::SHAPE_VARS::kind, CONSTRAINT_MEMBER::m_anchor, CONSTRAINT_MEMBER::m_index, CONSTRAINT_MEMBER::m_item, m_shapeVars, POINT_PAIR, POLYGON, RECTANGLE, SEGMENT, START, BOARD_CONSTRAINT_ADAPTER::SHAPE_VARS::startIsLeft, BOARD_CONSTRAINT_ADAPTER::SHAPE_VARS::startIsTop, BOARD_CONSTRAINT_ADAPTER::SHAPE_VARS::startX, VERTEX, and BOARD_CONSTRAINT_ADAPTER::SHAPE_VARS::vertexCount.
Referenced by AnchorPosition(), ApplyReferenceValues(), Build(), pinDraggedShapeRest(), Solve(), SolveBlockEdit(), and SolveSnapRelations().
| std::optional< VECTOR2I > BOARD_CONSTRAINT_ADAPTER::AnchorPosition | ( | const CONSTRAINT_MEMBER & | aMember | ) | const |
Definition at line 2351 of file board_constraint_adapter.cpp.
References anchorParams(), denormalizeX(), denormalizeY(), BOARD_CONSTRAINT_ADAPTER::ANCHOR_PARAMS::IsValid(), KiROUND(), m_params, BOARD_CONSTRAINT_ADAPTER::ANCHOR_PARAMS::x, and BOARD_CONSTRAINT_ADAPTER::ANCHOR_PARAMS::y.
| std::vector< PCB_SHAPE * > BOARD_CONSTRAINT_ADAPTER::Apply | ( | const std::function< void(BOARD_ITEM *)> & | aBeforeWrite = {} | ) |
Write the solved coordinates back into the shapes, de-normalized to IU.
Only shapes whose geometry actually changed are written. aBeforeWrite, if set, is invoked with each such shape immediately before it is mutated, so a caller can stage it in an undo commit (BOARD_COMMIT::Modify) before the change. A rigid footprint is moved whole and passed to aBeforeWrite, but its children are not reported as changed shapes.
Definition at line 2812 of file board_constraint_adapter.cpp.
References std::abs(), ARC, BEZIER, center, CIRCLE, SHAPE_POLY_SET::COutline(), SHAPE_LINE_CHAIN::CPoint(), delta, denormalizeX(), denormalizeY(), ELLIPSE, ELLIPSE_ARC, end, PCB_DIM_RADIAL::GetKnee(), PCB_TEXT::GetTextPos(), SHAPE_POLY_SET::HoleCount(), KiROUND(), m_built, m_params, M_PI, m_rigidFootprints, m_rigidMembers, m_scale, m_shapeVars, moved, SHAPE_POLY_SET::OutlineCount(), PAD_CENTER, PCB_DIM_RADIAL_T, POINT_PAIR, SHAPE_LINE_CHAIN::PointCount(), POLYGON, RADIANS_T, radius, RECTANGLE, EDA_TEXT::SetTextPos(), EDA_ITEM::Type(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), ReSolveAfterShapeResize(), KI_TEST::solveAndApply(), and SolveCluster().
| void BOARD_CONSTRAINT_ADAPTER::ApplyReferenceValues | ( | const std::function< void(BOARD_ITEM *)> & | aBeforeWrite = {} | ) |
Propagate solved reference (non-driving) constraint values back into their m_value so a reference dimension tracks the geometry it measures.
Call after Apply(); the value is measured from the written shape geometry (not the raw solver param, which rounds separately), so a settled solve re-measures the same value and stages nothing. The value is always written when it changed; aBeforeWrite, if set, stages that constraint (BOARD_COMMIT::Modify) first so the write is undoable. Driving constraints are never touched.
Definition at line 428 of file board_constraint_adapter.cpp.
References std::abs(), anchor, anchorParams(), ANGULAR_DIMENSION, ARC_ANGLE, EDA_ANGLE::AsDegrees(), denormalizeX(), denormalizeY(), FIXED_LENGTH, FIXED_RADIUS, EDA_SHAPE::GetArcAngle(), EDA_SHAPE::GetEnd(), EDA_SHAPE::GetRadius(), EDA_SHAPE::GetStart(), PCB_DIM_ORTHOGONAL::HORIZONTAL, KiROUND(), m_built, m_params, m_referenceConstraints, m_shapeVars, MeasureCornerAngle(), ortho, and orthogonalDimensionForMembers().
Referenced by ReSolveAfterShapeResize(), and SolveCluster().
|
private |
Definition at line 415 of file board_constraint_adapter.cpp.
References m_nextTemporaryParam.
Referenced by Solve(), Solve(), SolveAfterResize(), SolveBlockEdit(), SolveRigidSnapRelations(), SolveRigidTranslation(), and SolveSnapRelations().
| bool BOARD_CONSTRAINT_ADAPTER::Build | ( | const std::vector< PCB_SHAPE * > & | aShapes, |
| const std::vector< PCB_CONSTRAINT * > & | aConstraints, | ||
| const std::set< KIID > * | aFixedShapes = nullptr, | ||
| const std::vector< PCB_DIMENSION_BASE * > & | aDimensions = {}, | ||
| const std::vector< PAD * > & | aPads = {} ) |
Translate a cluster into a planegcs system.
| aShapes | the shapes referenced by the constraints (resolved by the caller). |
| aConstraints | the constraints relating those shapes. |
| aFixedShapes | shapes to treat as immovable references (their whole span is frozen). |
| aDimensions | dimensions referenced by the constraints; each contributes its two feature points, so a coincident constraint can drag a dimension along with a shape. |
| aPads | pads referenced by the constraints; each contributes its centre point. |
Outside the footprint editor a footprint is a rigid body. Its children in the cluster share one free translation and write-back moves the footprint itself. A pad never moves on its own, so in the footprint editor it is grounded.
Definition at line 641 of file board_constraint_adapter.cpp.
References anchor, anchorParams(), ANGLE_90, ANGULAR_DIMENSION, ARC, ARC, ARC_ANGLE, BOARD_CONSTRAINT_ADAPTER::SHAPE_VARS::arcEndX, BOARD_CONSTRAINT_ADAPTER::SHAPE_VARS::arcStartX, arcSweepTarget(), EDA_ANGLE::AsRadians(), BEZIER, BEZIER, boardFootprintOf(), center, CIRCLE, CIRCLE, COINCIDENT, COLLINEAR, CONCENTRIC, ConstraintItemIsLocked(), ConstraintPolygonIsModelable(), coupleRigidFootprints(), SHAPE_LINE_CHAIN::CPoint(), BOARD_CONSTRAINT_ADAPTER::SHAPE_VARS::dimension, directedAngleForCorner(), ELLIPSE, ELLIPSE, ELLIPSE_ARC, ELLIPSE_ARC, end, BOARD_CONSTRAINT_ADAPTER::SHAPE_VARS::endAngle, BOARD_CONSTRAINT_ADAPTER::SHAPE_VARS::endX, EQUAL_LENGTH, EQUAL_RADIUS, FIXED_LENGTH, FIXED_POSITION, FIXED_RADIUS, BOARD_CONSTRAINT_ADAPTER::SHAPE_VARS::focusX, HORIZONTAL, PCB_DIM_ORTHOGONAL::HORIZONTAL, isDegenerateLine(), BOARD_CONSTRAINT_ADAPTER::ANCHOR_PARAMS::IsValid(), itemOf(), IU_PER_NORM_UNIT, BOARD_CONSTRAINT_ADAPTER::SHAPE_VARS::kind, locked, CONSTRAINT_MEMBER::m_anchor, m_angleConstrainedShapes, m_built, m_coDragTargetX, m_coDragTargetY, m_dragTargetX, m_dragTargetY, m_droppedTags, m_fixedParams, m_gcs, m_groundedPositionParams, m_invScale, CONSTRAINT_MEMBER::m_item, m_lengthHoldTag, m_nextTemporaryParam, m_nonDrivingTags, m_params, M_PI, m_referenceConstraints, m_resizeRadiusTag, m_rigidFootprints, m_rigidMembers, m_scale, m_shapeVars, m_system, m_tagMembers, m_tagToConstraint, m_temporaryParams, m_unmapped, MAX_SOLVE_ITERATIONS, MIDPOINT, normalizeX(), normalizeY(), ortho, orthogonalDimensionForMembers(), pad, BOARD_CONSTRAINT_ADAPTER::SHAPE_VARS::pad, PAD_CENTER, PARALLEL, PCB_DIM_ALIGNED_T, PCB_DIM_ORTHOGONAL_T, PCB_DIM_RADIAL_T, PERPENDICULAR, POINT_ON_LINE, POINT_PAIR, SHAPE_LINE_CHAIN::PointCount(), POLY, POLYGON, pushParam(), BOARD_CONSTRAINT_ADAPTER::SHAPE_VARS::radius, recordReferenceValue(), RECTANGLE, RECTANGLE, SEGMENT, SEGMENT, BOARD_CONSTRAINT_ADAPTER::SHAPE_VARS::shape, sign(), BOARD_CONSTRAINT_ADAPTER::SHAPE_VARS::startAngle, BOARD_CONSTRAINT_ADAPTER::SHAPE_VARS::startIsLeft, BOARD_CONSTRAINT_ADAPTER::SHAPE_VARS::startIsTop, BOARD_CONSTRAINT_ADAPTER::SHAPE_VARS::startX, SYMMETRIC, TANGENT, BOARD_CONSTRAINT_ADAPTER::SHAPE_VARS::vertexCount, VERTICAL, WHOLE, BOARD_CONSTRAINT_ADAPTER::ANCHOR_PARAMS::x, VECTOR2< T >::x, BOARD_CONSTRAINT_ADAPTER::ANCHOR_PARAMS::y, and VECTOR2< T >::y.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), diagnoseSingleCluster(), ReSolveAfterShapeResize(), KI_TEST::solveAndApply(), and SolveCluster().
|
private |
Definition at line 1960 of file board_constraint_adapter.cpp.
References ARC, BOARD_CONSTRAINT_ADAPTER::SHAPE_VARS::arcEndX, BOARD_CONSTRAINT_ADAPTER::SHAPE_VARS::arcStartX, BEZIER, CIRCLE, ELLIPSE, ELLIPSE_ARC, BOARD_CONSTRAINT_ADAPTER::SHAPE_VARS::endX, BOARD_CONSTRAINT_ADAPTER::SHAPE_VARS::focusX, BOARD_CONSTRAINT_ADAPTER::SHAPE_VARS::kind, m_shapeVars, PAD_CENTER, POINT_PAIR, BOARD_CONSTRAINT_ADAPTER::RIGID_STATE::points, POLYGON, BOARD_CONSTRAINT_ADAPTER::RIGID_STATE::radii, BOARD_CONSTRAINT_ADAPTER::SHAPE_VARS::radius, RECTANGLE, SEGMENT, BOARD_CONSTRAINT_ADAPTER::SHAPE_VARS::startX, and BOARD_CONSTRAINT_ADAPTER::SHAPE_VARS::vertexCount.
Referenced by coupleRigidFootprints(), holdShapesRigid(), pinUncommandedCoordinates(), SolveBlockEdit(), SolveRigidSnapRelations(), and SolveRigidTranslation().
|
private |
Tie every mapped child of each footprint in aFootprints to one shared translation, or freeze them all when any is locked or in aFixedShapes, adding frozen params to aFixed.
Definition at line 1559 of file board_constraint_adapter.cpp.
References boardFootprintOf(), BOARD_CONSTRAINT_ADAPTER::RIGID_FOOTPRINT::buildPosition, collectRigidState(), ConstraintItemIsLocked(), BOARD_CONSTRAINT_ADAPTER::RIGID_FOOTPRINT::footprint, itemOf(), m_gcs, m_params, m_rigidFootprints, m_rigidMembers, m_shapeVars, BOARD_CONSTRAINT_ADAPTER::RIGID_STATE::points, pushParam(), BOARD_CONSTRAINT_ADAPTER::RIGID_STATE::radii, BOARD_CONSTRAINT_ADAPTER::RIGID_RADIUS_HOLD::radius, and BOARD_CONSTRAINT_ADAPTER::RIGID_FOOTPRINT::translationX.
Referenced by Build().
|
inline |
Definition at line 253 of file board_constraint_adapter.h.
References hardRelationsSatisfied().
Referenced by BOOST_AUTO_TEST_CASE().
|
inlineprivate |
Definition at line 429 of file board_constraint_adapter.h.
References m_system.
Referenced by AnchorPosition(), Apply(), ApplyReferenceValues(), QuantizedRelationsSatisfied(), SolveBlockEdit(), SolveRigidSnapRelations(), and SolveRigidTranslation().
|
inlineprivate |
Definition at line 430 of file board_constraint_adapter.h.
References m_system.
Referenced by AnchorPosition(), Apply(), ApplyReferenceValues(), QuantizedRelationsSatisfied(), SolveBlockEdit(), SolveRigidSnapRelations(), and SolveRigidTranslation().
| CONSTRAINT_DIAGNOSIS BOARD_CONSTRAINT_ADAPTER::Diagnose | ( | ) |
Report degrees of freedom and conflicting/redundant constraints.
The residual check reads the last solve's params; a contradictory cluster diverges under the stabilize holds, and the finite residuals it leaves behind are what flag the conflict.
Definition at line 3129 of file board_constraint_adapter.cpp.
References std::abs(), CONSTRAINT_DIAGNOSIS::conflicting, CONSTRAINT_DIAGNOSIS::freeDof, m_built, m_gcs, m_invScale, m_nonDrivingTags, m_params, m_shapeVars, m_tagMembers, m_tagToConstraint, CONSTRAINT_DIAGNOSIS::redundant, and SEGMENT.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), diagnoseSingleCluster(), and SolveCluster().
| int BOARD_CONSTRAINT_ADAPTER::DropStaleRelations | ( | ) |
Remove the constraints the current geometry already fails to satisfy.
A constraint that does not hold at the baseline records no live intent, and leaving it in the system makes the whole cluster count as conflicted, which switches off the constraints beside it that do hold. Returns how many were removed.
Definition at line 2425 of file board_constraint_adapter.cpp.
References m_droppedTags, m_gcs, and staleRelationTags().
|
private |
Definition at line 2382 of file board_constraint_adapter.cpp.
References std::abs(), m_gcs, parametersFinite(), and staleRelationTags().
Referenced by CurrentRelationsSatisfied(), QuantizedRelationsSatisfied(), and solveSucceeded().
|
private |
Hold aVars's arc at its current radius (tagged aTag).
Definition at line 2751 of file board_constraint_adapter.cpp.
References circle(), m_gcs, m_params, BOARD_CONSTRAINT_ADAPTER::SHAPE_VARS::radius, BOARD_CONSTRAINT_ADAPTER::SHAPE_VARS::startX, and temporaryParam().
Referenced by holdFreeArcRadii(), and pinDraggedShapeRest().
|
private |
Radius hold on the free arcs in aShapes tagged aTag so an angle change rotates an endpoint instead of collapsing the arc a real FIXED_RADIUS still wins.
Definition at line 2762 of file board_constraint_adapter.cpp.
References ARC, ConstraintItemIsLocked(), holdArcRadius(), and m_shapeVars.
|
private |
Length hold on the free segments in aShapes tagged aTag so only those shapes are protected while a merely dragged-along neighbour keeps its own stay-put pins instead.
Definition at line 2730 of file board_constraint_adapter.cpp.
References ConstraintItemIsLocked(), m_gcs, m_params, m_shapeVars, SEGMENT, and temporaryParam().
|
private |
Soft-pin every vertex of each POLYGON in aShapes tagged aTag for edited shapes pinUneditedShapes excludes so unbound vertices keep their null-space minimal-movement pins.
Definition at line 2714 of file board_constraint_adapter.cpp.
References ConstraintItemIsLocked(), m_shapeVars, POLYGON, softPinPoint(), and STAY_PUT_WEIGHT.
Referenced by Solve(), and SolveAfterResize().
|
private |
Definition at line 2031 of file board_constraint_adapter.cpp.
References circle(), m_gcs, m_params, and temporaryParam().
Referenced by holdShapesRigid(), SolveRigidSnapRelations(), and SolveRigidTranslation().
|
private |
Hold the shapes in aShapes rigid, tagged aTag, so a shape the solve moves translates instead of stretching.
Definition at line 2779 of file board_constraint_adapter.cpp.
References collectRigidState(), ConstraintItemIsLocked(), holdRigidRadii(), m_gcs, m_params, m_shapeVars, BOARD_CONSTRAINT_ADAPTER::RIGID_STATE::points, BOARD_CONSTRAINT_ADAPTER::RIGID_STATE::radii, and temporaryParam().
Referenced by Solve().
|
staticprivate |
Definition at line 1547 of file board_constraint_adapter.cpp.
References BOARD_CONSTRAINT_ADAPTER::SHAPE_VARS::dimension, BOARD_CONSTRAINT_ADAPTER::SHAPE_VARS::pad, and BOARD_CONSTRAINT_ADAPTER::SHAPE_VARS::shape.
Referenced by Build(), and coupleRigidFootprints().
|
inlineprivate |
IU <-> normalized (millimetre, cluster-centred) frame, per axis.
Definition at line 427 of file board_constraint_adapter.h.
References m_system.
Referenced by addSnapRelations(), Build(), QuantizedRelationsSatisfied(), Solve(), SolveBlockEdit(), SolveRigidSnapRelations(), and SolveSnapRelations().
|
inlineprivate |
Definition at line 428 of file board_constraint_adapter.h.
References m_system.
Referenced by addSnapRelations(), Build(), QuantizedRelationsSatisfied(), Solve(), SolveBlockEdit(), SolveRigidSnapRelations(), and SolveSnapRelations().
|
delete |
References BOARD_CONSTRAINT_ADAPTER().
|
private |
The orthogonal dimension a two-point length constraint drives or nullptr requires both members to be the same dimension START and END in either order.
Definition at line 615 of file board_constraint_adapter.cpp.
References END, m_shapeVars, PCB_DIM_ORTHOGONAL_T, POINT_PAIR, and START.
Referenced by ApplyReferenceValues(), and Build().
|
private |
Definition at line 2372 of file board_constraint_adapter.cpp.
References m_params.
Referenced by hardRelationsSatisfied(), and solveSucceeded().
|
private |
Hold the parts of the dragged shape meant to stay put tagged aTag a segment holds its far endpoint an arc holds centre radius and far endpoint or both endpoints on a centre drag.
Definition at line 2582 of file board_constraint_adapter.cpp.
References anchorParams(), ARC, BOARD_CONSTRAINT_ADAPTER::SHAPE_VARS::arcEndX, BOARD_CONSTRAINT_ADAPTER::SHAPE_VARS::arcStartX, BEZIER, CENTER, END, BOARD_CONSTRAINT_ADAPTER::SHAPE_VARS::endX, holdArcRadius(), BOARD_CONSTRAINT_ADAPTER::SHAPE_VARS::kind, CONSTRAINT_MEMBER::m_anchor, CONSTRAINT_MEMBER::m_index, CONSTRAINT_MEMBER::m_item, m_shapeVars, POLYGON, RECTANGLE, SEGMENT, softPinPoint(), START, BOARD_CONSTRAINT_ADAPTER::SHAPE_VARS::startX, VERTEX, and BOARD_CONSTRAINT_ADAPTER::SHAPE_VARS::vertexCount.
Referenced by Solve(), and SolveSnapRelations().
|
private |
Weakly hold every cluster coordinate outside aCommanded where it sits, tagged aTag, so nothing the caller left alone moves further than the constraints force.
A shape with a held coordinate keeps its radii at full weight.
Definition at line 2540 of file board_constraint_adapter.cpp.
References BOARD_CONSTRAINT_ADAPTER::RIGID_RADIUS_HOLD::centerX, circle(), collectRigidState(), ConstraintItemIsLocked(), m_gcs, m_params, m_shapeVars, BOARD_CONSTRAINT_ADAPTER::RIGID_STATE::points, BOARD_CONSTRAINT_ADAPTER::RIGID_STATE::radii, BOARD_CONSTRAINT_ADAPTER::RIGID_RADIUS_HOLD::radius, softPinCoordinate(), STAY_PUT_WEIGHT, and temporaryParam().
Referenced by SolveBlockEdit().
|
private |
Soft-pin every cluster shape not in aEdited at its current geometry tagged aTag for a minimal-movement solve aEdited must list every edited shape or a neighbour gets held back.
Definition at line 2644 of file board_constraint_adapter.cpp.
References ARC, BEZIER, CIRCLE, circle(), ConstraintItemIsLocked(), ELLIPSE, ELLIPSE_ARC, m_gcs, m_params, m_shapeVars, PAD_CENTER, POINT_PAIR, POLYGON, RECTANGLE, SEGMENT, softPinPoint(), STAY_PUT_WEIGHT, and temporaryParam().
Referenced by Solve(), Solve(), SolveAfterResize(), SolveRigidSnapRelations(), SolveRigidTranslation(), and SolveSnapRelations().
|
private |
Append a normalized coordinate to the backing store, returning its stable index.
Definition at line 398 of file board_constraint_adapter.cpp.
References m_system.
Referenced by Build(), coupleRigidFootprints(), and temporaryParam().
| bool BOARD_CONSTRAINT_ADAPTER::QuantizedRelationsSatisfied | ( | ) |
Definition at line 2444 of file board_constraint_adapter.cpp.
References denormalizeX(), denormalizeY(), hardRelationsSatisfied(), index, KiROUND(), m_invScale, m_params, m_scale, m_shapeVars, normalizeX(), normalizeY(), POLYGON, Restore(), and Snapshot().
Referenced by SolveRigidSnapRelations(), and SolveRigidTranslation().
|
private |
Note a non-driving valued constraint so its measured value can be read back after a solve.
A driving constraint is ignored here – its value is an input, never overwritten.
Definition at line 421 of file board_constraint_adapter.cpp.
References PCB_CONSTRAINT::IsDriving(), and m_referenceConstraints.
Referenced by Build().
|
inline |
Definition at line 250 of file board_constraint_adapter.h.
References m_system.
Referenced by BOOST_AUTO_TEST_CASE(), and QuantizedRelationsSatisfied().
|
inline |
Definition at line 249 of file board_constraint_adapter.h.
References m_system.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and QuantizedRelationsSatisfied().
|
private |
Hold the one coordinate at aParam where it sits, tagged aTag, with aWeight scaling the tier.
Used where an anchor's two coordinates are set one at a time, as a rectangle corner's shared pair is. A negative param is ignored.
Definition at line 2524 of file board_constraint_adapter.cpp.
References m_gcs, m_params, pin, and temporaryParam().
Referenced by pinUncommandedCoordinates(), and SolveBlockEdit().
|
private |
Pin the point at aPoint where it sits tagged aTag with aWeight rescaling the tier or the default weight overriding the stay-put tier when unset an invalid point is ignored.
Definition at line 2494 of file board_constraint_adapter.cpp.
References BOARD_CONSTRAINT_ADAPTER::ANCHOR_PARAMS::IsValid(), m_gcs, m_params, temporaryParam(), BOARD_CONSTRAINT_ADAPTER::ANCHOR_PARAMS::x, and BOARD_CONSTRAINT_ADAPTER::ANCHOR_PARAMS::y.
Referenced by holdPolygonVertices(), pinDraggedShapeRest(), pinUneditedShapes(), softPinPoint(), and SolveRigidTranslation().
|
private |
As above for the point whose x param is aPointX and whose y param follows it.
Definition at line 2517 of file board_constraint_adapter.cpp.
References softPinPoint().
| bool BOARD_CONSTRAINT_ADAPTER::Solve | ( | bool | aStabilize = false | ) |
Solve with no drag pin. aStabilize holds free segment lengths (see the dragged overload).
Definition at line 1619 of file board_constraint_adapter.cpp.
References beginTemporaryParameters(), holdFreeArcRadii(), holdFreeSegmentLengths(), m_angleConstrainedShapes, m_built, m_gcs, m_lengthHoldTag, pinUneditedShapes(), and solveSucceeded().
| bool BOARD_CONSTRAINT_ADAPTER::Solve | ( | const CONSTRAINT_MEMBER & | aDragged, |
| const VECTOR2I & | aCursor, | ||
| bool | aStabilize = false, | ||
| const std::set< KIID > & | aEdited = {}, | ||
| const std::optional< std::pair< CONSTRAINT_MEMBER, VECTOR2I > > & | aCoDragged = std::nullopt, | ||
| bool | aHoldDraggedRigid = false ) |
Solve the system, pinning a dragged anchor to a cursor position.
The pin is a temporary (negatively tagged) constraint, so it yields to the real ones and an over-constrained drag leaves the geometry where the rules allow.
| aDragged | the anchor being dragged. |
| aCursor | the cursor target, in IU. |
| aStabilize | holds free segment lengths so an angle constraint rotates a segment instead of collapsing it. Off for live dragging. |
| aEdited | other shapes edited alongside the dragged one excluded from stay-put pins |
| aCoDragged | second anchor moved by the same handle with its own target pinned at the same weight since a polygon edge drag needs two independent points |
| aHoldDraggedRigid | holds the dragged shape's own geometry, so it travels whole instead of stretching to meet the relation. |
Definition at line 1711 of file board_constraint_adapter.cpp.
References anchor, anchorParams(), ARC, beginTemporaryParameters(), END, BOARD_CONSTRAINT_ADAPTER::SHAPE_VARS::endX, BOARD_CONSTRAINT_ADAPTER::SHAPE_VARS::fixedLengthParam, holdFreeArcRadii(), holdFreeSegmentLengths(), holdPolygonVertices(), holdShapesRigid(), BOARD_CONSTRAINT_ADAPTER::ANCHOR_PARAMS::IsValid(), CONSTRAINT_MEMBER::m_anchor, m_angleConstrainedShapes, m_built, m_coDragTargetX, m_coDragTargetY, m_dragTargetX, m_dragTargetY, m_gcs, CONSTRAINT_MEMBER::m_item, m_params, m_shapeVars, normalizeX(), normalizeY(), pinDraggedShapeRest(), pinUneditedShapes(), BOARD_CONSTRAINT_ADAPTER::SHAPE_VARS::radius, radius, SEGMENT, solveSucceeded(), START, BOARD_CONSTRAINT_ADAPTER::SHAPE_VARS::startX, BOARD_CONSTRAINT_ADAPTER::ANCHOR_PARAMS::x, VECTOR2< T >::x, BOARD_CONSTRAINT_ADAPTER::ANCHOR_PARAMS::y, and VECTOR2< T >::y.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), diagnoseSingleCluster(), KI_TEST::solveAndApply(), and SolveCluster().
| bool BOARD_CONSTRAINT_ADAPTER::SolveAfterResize | ( | const KIID & | aResizedShape | ) |
Solve after a resize.
Holds the resized radius, pins its centre (yielding), and holds the other radii (yielding), so neighbours translate and the resized shape moves only if forced.
Definition at line 1652 of file board_constraint_adapter.cpp.
References beginTemporaryParameters(), holdPolygonVertices(), m_built, m_gcs, m_params, m_resizeRadiusTag, m_shapeVars, pinUneditedShapes(), solveSucceeded(), and temporaryParam().
Referenced by ReSolveAfterShapeResize().
| CONSTRAINT_BLOCK_RESULT BOARD_CONSTRAINT_ADAPTER::SolveBlockEdit | ( | const std::vector< std::pair< CONSTRAINT_MEMBER, VECTOR2I > > & | aPinnedAnchors, |
| const std::set< KIID > & | aTranslatedShapes, | ||
| const VECTOR2I & | aTranslation ) |
Solve a block edit whose geometry the caller has already written.
Every coordinate the caller names is held exactly where the caller put it. Every other coordinate in the cluster is held with a weak pull back to where it was, so an anchor of an edited shape that the user did not pick, and an untouched neighbour, each move only as far as the constraints make them. The result is handed back for the caller to apply.
Some named coordinates cannot move at all, such as a locked shape's or a dimension point no constraint binds. Those are read as constants, since the caller has already put the item there. If a constraint then breaks, the solve is still refused.
A point a FIXED_POSITION constraint pins is the exception. It is never read from the caller: a pinned anchor is left uncommanded so the solve puts it back, and a shape that would carry one along is refused outright.
| aPinnedAnchors | the anchors the user placed, each with its target in IU. |
| aTranslatedShapes | shapes that travelled whole, with all of their coordinates held. |
| aTranslation | how far those shapes travelled from the current parameters. |
Definition at line 2159 of file board_constraint_adapter.cpp.
References anchor, anchorParams(), beginTemporaryParameters(), collectRigidState(), denormalizeX(), denormalizeY(), KiROUND(), m_built, m_gcs, m_groundedPositionParams, m_params, normalizeX(), normalizeY(), NOT_MODELED, pinUncommandedCoordinates(), BOARD_CONSTRAINT_ADAPTER::RIGID_STATE::points, REFUSED, softPinCoordinate(), SOLVED, solveSucceeded(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by BOOST_AUTO_TEST_CASE(), and BOOST_FIXTURE_TEST_CASE().
| bool BOARD_CONSTRAINT_ADAPTER::SolveRigidSnapRelations | ( | const std::set< KIID > & | aEditedShapes, |
| const VECTOR2I & | aReference, | ||
| const std::vector< SNAP_CANDIDATE > & | aCandidates, | ||
| const VECTOR2I & | aCursor, | ||
| VECTOR2I & | aResolvedCursor ) |
Definition at line 2264 of file board_constraint_adapter.cpp.
References SNAP_RESULT::Accepted(), SNAP_RESOLVER::AddCandidate(), addSnapRelations(), anchor, beginTemporaryParameters(), collectRigidState(), CURSOR_WEIGHT, denormalizeX(), denormalizeY(), holdRigidRadii(), KiROUND(), m_built, m_gcs, m_params, normalizeX(), normalizeY(), pinUneditedShapes(), BOARD_CONSTRAINT_ADAPTER::RIGID_STATE::points, SNAP_RESULT::position, QuantizedRelationsSatisfied(), BOARD_CONSTRAINT_ADAPTER::RIGID_STATE::radii, SNAP_RESOLVER::Resolve(), solveSucceeded(), SNAP_SOURCE_CONTEXT::sourcePoint, temporaryParam(), VECTOR2< T >::x, and VECTOR2< T >::y.
| bool BOARD_CONSTRAINT_ADAPTER::SolveRigidTranslation | ( | const std::set< KIID > & | aEditedShapes, |
| const VECTOR2I & | aTranslation ) |
Definition at line 2095 of file board_constraint_adapter.cpp.
References beginTemporaryParameters(), collectRigidState(), denormalizeX(), denormalizeY(), holdRigidRadii(), KiROUND(), m_built, m_gcs, m_invScale, m_params, pinUneditedShapes(), BOARD_CONSTRAINT_ADAPTER::RIGID_STATE::points, QuantizedRelationsSatisfied(), BOARD_CONSTRAINT_ADAPTER::RIGID_STATE::radii, softPinPoint(), solveSucceeded(), TravelsWhole(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by BOOST_FIXTURE_TEST_CASE().
| bool BOARD_CONSTRAINT_ADAPTER::SolveSnapRelations | ( | const CONSTRAINT_MEMBER & | aDragged, |
| const std::vector< SNAP_CANDIDATE > & | aCandidates, | ||
| const VECTOR2I & | aCursor ) |
Definition at line 2044 of file board_constraint_adapter.cpp.
References addSnapRelations(), anchor, anchorParams(), beginTemporaryParameters(), CURSOR_WEIGHT, BOARD_CONSTRAINT_ADAPTER::ANCHOR_PARAMS::IsValid(), m_built, m_gcs, CONSTRAINT_MEMBER::m_item, m_params, normalizeX(), normalizeY(), pinDraggedShapeRest(), pinUneditedShapes(), solveSucceeded(), temporaryParam(), BOARD_CONSTRAINT_ADAPTER::ANCHOR_PARAMS::x, VECTOR2< T >::x, BOARD_CONSTRAINT_ADAPTER::ANCHOR_PARAMS::y, and VECTOR2< T >::y.
|
private |
Decide whether a solve reached a usable result a raw Success or Converged qualifies while a Failed code is accepted only when every driving hard constraint is still satisfied A state with a non-finite parameter never qualifies, so it can never be written to the board.
Definition at line 2363 of file board_constraint_adapter.cpp.
References hardRelationsSatisfied(), and parametersFinite().
Referenced by Solve(), Solve(), SolveAfterResize(), SolveBlockEdit(), SolveRigidSnapRelations(), SolveRigidTranslation(), and SolveSnapRelations().
|
private |
Driving constraint tags whose residual is already out of tolerance, ignoring dropped ones.
Definition at line 2404 of file board_constraint_adapter.cpp.
References std::abs(), m_droppedTags, m_gcs, m_nonDrivingTags, and m_tagToConstraint.
Referenced by DropStaleRelations(), and hardRelationsSatisfied().
|
private |
Definition at line 404 of file board_constraint_adapter.cpp.
References index, m_nextTemporaryParam, m_params, m_temporaryParams, and pushParam().
Referenced by addSnapRelations(), holdArcRadius(), holdFreeSegmentLengths(), holdRigidRadii(), holdShapesRigid(), pinUncommandedCoordinates(), pinUneditedShapes(), softPinCoordinate(), softPinPoint(), SolveAfterResize(), SolveRigidSnapRelations(), and SolveSnapRelations().
| bool BOARD_CONSTRAINT_ADAPTER::TravelsWhole | ( | const std::set< KIID > & | aEditedShapes | ) | const |
True when every shape in the cluster is in aEditedShapes and free to travel with it.
Definition at line 2083 of file board_constraint_adapter.cpp.
References ConstraintItemIsLocked(), and m_shapeVars.
Referenced by SolveRigidTranslation().
|
inline |
Constraints from the last Build() that could not be mapped onto a solver primitive (wrong member count/kind for their type, e.g.
a parallel whose shape was changed to a circle), so they are silently not enforced. Callers surface these as errored.
Definition at line 151 of file board_constraint_adapter.h.
References m_unmapped.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and diagnoseSingleCluster().
|
private |
Shapes a direction or angle constraint could collapse to a point only these get a stabilize length or radius hold.
Definition at line 457 of file board_constraint_adapter.h.
|
private |
Definition at line 474 of file board_constraint_adapter.h.
Referenced by Apply(), ApplyReferenceValues(), Build(), Diagnose(), Solve(), Solve(), SolveAfterResize(), SolveBlockEdit(), SolveRigidSnapRelations(), SolveRigidTranslation(), and SolveSnapRelations().
|
private |
Backing slot for the co-dragged pin x target.
Definition at line 464 of file board_constraint_adapter.h.
|
private |
Backing slot for the co-dragged pin y target.
Definition at line 465 of file board_constraint_adapter.h.
|
private |
Stable backing slot for the drag pin's x target (-1 = unset).
Definition at line 462 of file board_constraint_adapter.h.
|
private |
Stable backing slot for the drag pin's y target.
Definition at line 463 of file board_constraint_adapter.h.
|
private |
Stale relations taken out of the system.
Definition at line 447 of file board_constraint_adapter.h.
Referenced by Build(), DropStaleRelations(), and staleRelationTags().
|
private |
Parameter indices the solver may not move, so a rigid translation may not either.
Definition at line 441 of file board_constraint_adapter.h.
Referenced by Build().
|
private |
Definition at line 433 of file board_constraint_adapter.h.
Referenced by addSnapRelations(), BOARD_CONSTRAINT_ADAPTER(), Build(), coupleRigidFootprints(), Diagnose(), DropStaleRelations(), hardRelationsSatisfied(), holdArcRadius(), holdFreeSegmentLengths(), holdRigidRadii(), holdShapesRigid(), pinUncommandedCoordinates(), pinUneditedShapes(), softPinCoordinate(), softPinPoint(), Solve(), Solve(), SolveAfterResize(), SolveBlockEdit(), SolveRigidSnapRelations(), SolveRigidTranslation(), SolveSnapRelations(), and staleRelationTags().
|
private |
The subset of those grounded by a FIXED_POSITION constraint rather than by a lock or a driving constant, which a block edit may not command to a new place.
Definition at line 445 of file board_constraint_adapter.h.
Referenced by Build(), and SolveBlockEdit().
|
private |
1 / m_scale.
Definition at line 460 of file board_constraint_adapter.h.
Referenced by addSnapRelations(), Build(), Diagnose(), QuantizedRelationsSatisfied(), and SolveRigidTranslation().
|
private |
Definition at line 471 of file board_constraint_adapter.h.
|
private |
Definition at line 467 of file board_constraint_adapter.h.
Referenced by beginTemporaryParameters(), Build(), and temporaryParam().
|
private |
Measurement-only; excluded from conflict residuals.
Definition at line 448 of file board_constraint_adapter.h.
Referenced by Build(), Diagnose(), and staleRelationTags().
|
private |
Definition at line 436 of file board_constraint_adapter.h.
Referenced by addSnapRelations(), AnchorPosition(), Apply(), ApplyReferenceValues(), BOARD_CONSTRAINT_ADAPTER(), Build(), coupleRigidFootprints(), Diagnose(), holdArcRadius(), holdFreeSegmentLengths(), holdRigidRadii(), holdShapesRigid(), parametersFinite(), pinUncommandedCoordinates(), pinUneditedShapes(), QuantizedRelationsSatisfied(), softPinCoordinate(), softPinPoint(), Solve(), SolveAfterResize(), SolveBlockEdit(), SolveRigidSnapRelations(), SolveRigidTranslation(), SolveSnapRelations(), and temporaryParam().
|
private |
Non-driving valued, read back after a solve.
Definition at line 450 of file board_constraint_adapter.h.
Referenced by ApplyReferenceValues(), Build(), and recordReferenceValue().
|
private |
Definition at line 472 of file board_constraint_adapter.h.
Referenced by Build(), and SolveAfterResize().
|
private |
Definition at line 452 of file board_constraint_adapter.h.
Referenced by Apply(), Build(), and coupleRigidFootprints().
|
private |
Mapped items that move only with their footprint.
Definition at line 453 of file board_constraint_adapter.h.
Referenced by Apply(), Build(), and coupleRigidFootprints().
|
private |
IU per normalized unit.
Definition at line 459 of file board_constraint_adapter.h.
Referenced by Apply(), Build(), and QuantizedRelationsSatisfied().
|
private |
Definition at line 438 of file board_constraint_adapter.h.
Referenced by anchorParams(), Apply(), ApplyReferenceValues(), Build(), collectRigidState(), coupleRigidFootprints(), Diagnose(), holdFreeArcRadii(), holdFreeSegmentLengths(), holdPolygonVertices(), holdShapesRigid(), orthogonalDimensionForMembers(), pinDraggedShapeRest(), pinUncommandedCoordinates(), pinUneditedShapes(), QuantizedRelationsSatisfied(), Solve(), SolveAfterResize(), and TravelsWhole().
|
private |
Definition at line 432 of file board_constraint_adapter.h.
Referenced by BOARD_CONSTRAINT_ADAPTER(), Build(), denormalizeX(), denormalizeY(), normalizeX(), normalizeY(), pushParam(), Restore(), and Snapshot().
|
private |
Member items per tag, for collapse attribution.
Definition at line 449 of file board_constraint_adapter.h.
Referenced by Build(), and Diagnose().
|
private |
Definition at line 446 of file board_constraint_adapter.h.
Referenced by Build(), Diagnose(), and staleRelationTags().
|
private |
Definition at line 466 of file board_constraint_adapter.h.
Referenced by Build(), and temporaryParam().
|
private |
Constraints Build() could not map (not enforced).
Definition at line 451 of file board_constraint_adapter.h.
Referenced by Build(), and UnmappedConstraints().