C3D Toolkit  Kernel - 118069, Vision - 2.16.7.1844

Geometric constraint solver. More...

#include <gcm_manager.h>

+ Inheritance diagram for MtGeomSolver:
+ Collaboration diagram for MtGeomSolver:

Public Member Functions

Definition functions of the constraint system.
MtPatternId AddPattern (MtMateType, MtArgument, MtArgument, MtParVariant par=MtParVariant::undef)
 Add a pattern.
 
MtPatternId SubPattern (MtPatternId ptrn, GCM_coord_name, MtArgument axis)
 Create the constraint coordinate of the coordinate system pattern.
 
MtConstraintId AddGeomToPattern (MtPatternId ptrn, MtArgument ptrnObj, MtParVariant par1=MtParVariant::undef, MtParVariant par2=MtParVariant::undef, GCM_scale scale=GCM_RIGID)
 Add a geometric object to the pattern.
 
MtResultCode3D AddConstraintItem (ItConstraintItem &)
 Add constraint. More...
 
ItConstraintItem * AddConstraint (MtMateType t, MtArgument g1, MtArgument g2, MtParVariant p1=MtParVariant::undef, MtParVariant p2=MtParVariant::undef, MtParVariant p3=MtParVariant::undef)
 Add mate (constraint) of two geometric objects. More...
 
ItConstraintItem * AddConstraint (MtMateType, MtArgument, MtArgument, MtArgument, MtParVariant p1=MtParVariant::undef, MtParVariant p2=MtParVariant::undef)
 Add constraint of three geometric objects.
 
ItGeomPtr AddGeom (MtGeomVariant)
 Add black box to the constraint system. More...
 
MtResultCode3D MoveGeom (ItGeom &g, ItGeomPtr tgtCl)
 Move a geometric object of a constraint system into a solid's subsystem (make it a subobject of a rigid cluster). More...
 
MtResultCode3D AddBlackbox (ItGCBlackbox &)
 
ItGeomPtr DependentGeom (ItConstraintItem *)
 The dependent object is defined naturally for the GCM_DEPENDENT constraint or is assigned using a #MtGeomSolver::SetDependent call.

 
ItGeomPtr SetDependentGeom (ItConstraintItem *, ItGeomPtr)
 
MtResultCode3D ChangeDefinition (ItConstraintItem &)
 Report about change in the data defining conjugation.
 
MtResultCode3D ChangeDimension (ItConstraintItem &)
 Report about change of float-parameter of dimensional conjugation.
 
MtResultCode3D ChangeGeomPositions ()
 Report about position change of conjugated solids. More...
 
ItGeom * CreateCluster (std::vector< ItGeom * > &)
 Create an user-defined cluster. More...
 
MtResultCode3D FixGeom (const ItGeom *)
 Freeze a geometric object by making it fixed in the LCS of the supercluster (or the WCS if the latter is not present). More...
 
MtResultCode3D FreezeGeom (const ItGeom *)
 Freeze a geometric object by making it fixed in the LCS of the supercluster (or the WCS if the latter is not present).
 
bool IsFixed (const ItGeom *)
 Check if a geometric object is frozen. More...
 
bool IsFrozen (const ItGeom *)
 Check if a geometric object is frozen.
 
void Flush ()
 Clear the system constraint.
 
MtResultCode3D RemoveAllBlackboxes ()
 Remove all the black boxes from the constraint system.
 
MtResultCode3D RemoveConstraint (ItConstraintItem *)
 Remove constraint from system.
 
MtResultCode3D RemoveBlackbox (ItGCBlackbox &)
 Remove black box from constraint system.
 
bool RemoveGeom (const ItGeom *)
 Remove geometric object from constraint system.
 
MtResultCode3D UnfixGeom (const ItGeom &)
 Free a frozen geometric object. More...
 
MtResultCode3D FreeGeom (const ItGeom &)
 Free a frozen geometric object.
 
Functions of solution and diagnostics
GCM_closest_params ClosestParams (const ItConstraintItem *) const
 The function evaluates a closest parameters that tend to satisfy dimension or constraint.
 
bool IsSatisfied (const ItConstraintItem &)
 Check if constraint is satisfied?
 
GCM_dof_result IsWellConstrained (const ItGeom &)
 Check if solid is fully-specified or fixed?
 
void DiagnoseConstraints ()
 Send out diagnostic codes to constraints. More...
 
MtResultCode3D Evaluate ()
 Solve the constraint system. More...
 
MbMatrix3D TransMatrix (ItGeomPtr) const
 Current or calculated position of a geometric object.
 
const ItGeom * Cluster (const ItGeom *subGeom) const
 Get cluster which contains a given geometric object.
 
Functions for interactive manipulation of the constraint system
void FinishReposition ()
 Finish the dragging mode.
 
ItGeom * GetMovingGeom () const
 Get manipulation object. Solver works with it when being in the dragging mode (rotating or moving).
 
MtResultCode3D PrepareReposition (ItGeom &movGeom, const MbPlacement3D &projPlane, const MbCartPoint3D &curPnt)
 Initialize mode of object moving in the screen plane. More...
 
MtResultCode3D PrepareReposition (ItGeom &rotGeom, const MbCartPoint3D &org, const MbVector3D &axis)
 Initialize mode of component rotation around a fixed point of axis.
More...
 
MtResultCode3D SolveReposition (ItGeom &gItem, const MbPlacement3D &newPos, MtRepositionMode movType)
 Solve the system for an arbitrary change of position of one solid. More...
 
MtResultCode3D SolveReposition (const MbCartPoint3D &curXYZ)
 Solve the system of conjugations for new position of cursor in the dragging mode. More...
 
MtResultCode3D SolveReposition (double alpha)
 Solve the system with the position of the component through one coordinate. More...
 
MtResultCode3D DynamicReposition (ItGeom &g, const MbPlacement3D &manip, const GCM_dragging &mode)
 Drag a geometric object within a system of constraints by repositioning dynamically its manipulator. More...
 
- Public Member Functions inherited from MtRefItem
refcount_t AddRef () const
 Adds a reference to this object.
 
refcount_t Release () const
 Releases a reference to this object.
 
refcount_t GetUseCount () const
 Returns a number of objects referring to this.
 

Auxiliary functions and queries.

bool IsMyGeom (const ItGeom &) const
 Check if geometric object belongs to the system.
 
bool IsMyConstraint (const ItConstraintItem &) const
 Check if geometric constraint belongs to the system.
 
ItGeomPtr Ground () const
 Get the cluster of rigid subset of objects which are given in global coordinate system.

 
GCM_system System () const
 Get a geometric constraint system, which is served by the solver.
 
void WriteSystem (TCHAR *fileName)
 
SPtr< ItConstraintsEnum > GetConstraintsEnum ()
 Get the constraints iterator.
 
MtAdjacentConstrsRange AdjacentConstraints (const ItGeom *) const
 Get the range of adjacent constraints of a geometric object.
 
GCM_geom _QueryArgument (const MtArgument &gArg)
 
const ItGeom * _SetDependencyGeom (MtGeomId gId, const ItGeom *gItem)
 
SPtr< MtGeomSolver > GCM_CreateSolver (SPtr< ItPositionManager > posMan)
 Create an object-oriented interface of 3D solver. More...
 
SPtr< MtGeomSolver > GCT_GetSolver (GCM_system gSys)
 

Detailed Description

Geometric constraint solver.

Interface of geometric solver. Client application can run any number of constraint systems, for each of them is put one copy of the solver by calling GCM_CreateSolver.

Member Function Documentation

◆ AddConstraintItem()

MtResultCode3D MtGeomSolver::AddConstraintItem ( ItConstraintItem &  )

Add constraint.

Returns
Returns GCM_RESULT_Ok if the constraint is successfully added, otherwise it will return an error code.

◆ AddConstraint()

Add mate (constraint) of two geometric objects.

Parameters
[in]t- Type of geometric constraint.
[in]g1,g2- Pair of geometric objects - arguments of constraint.
[in]p1- Condition of alignment for or these types of constraints like GCM_COINCIDENT, GCM_PARALLEL, GCM_PERPENDICULAR, GCM_CONCENTRIC, GCM_IN_PLACE, mct_Tangency. Values of this parameter are taken from GCM_alignment.
[in]p1- Numeric parameter (double) of dimensional constraints to the types of GCM_ANGLE, GCM_DISTANCE.
[in]p2- Tangency variant GCM_tan_choice for constraint with type GCM_TANGENCY or value GCM_alignment for dimensional constraint.
[in]p3- Irrelevant.
Returns
Geometric constraint.

◆ AddGeom()

ItGeomPtr MtGeomSolver::AddGeom ( MtGeomVariant  )

Add black box to the constraint system.

Parameters
[in]bBox- Interface of Interface black box.
Returns
Result code.
Add the geometric object.

◆ MoveGeom()

MtResultCode3D MtGeomSolver::MoveGeom ( ItGeom &  g,
ItGeomPtr  tgtCl 
)

Move a geometric object of a constraint system into a solid's subsystem (make it a subobject of a rigid cluster).

Parameters
[in]g- Geometric object.
[in]tgtCl- Target cluster.
Returns
Resulting code of operation.

In order to move the geometric object into the global system, the target cluster should be pointed as nullptr. On success, the function returns code GCM_RESULT_Ok. If the geometric object relates to MtGeomSolver::Ground() or has been used as an argument to call method MtGeomSolver::CreateCluster, then the function leaves the system hierarchy unchanged and returns special code GCM_RESULT_ImmovableGeom. If the target cluster has been used as an argument to call method MtGeomSolver::CreateCluster, then the function leaves the system hierarchy unchanged and returns special code GCM_RESULT_UnacceptableCluster. If the target cluster is nested into the geometric object (including when it is the same one), then the function leaves the system hierarchy unchanged and returns special code GCM_RESULT_CyclicMove.

Note
On removal of a cluster by method MtGeomSolver::RemoveGeom, all the geometric objects moved into it automatically move into its supercluster if such one is present, and to the global system otherwise.

◆ ChangeGeomPositions()

MtResultCode3D MtGeomSolver::ChangeGeomPositions ( )

Report about position change of conjugated solids.

Returns
Result code.

Using this function implements synchronization of position of objects of constraints as objects of a client application. It should be said that the update of the positions happens only for those inheritors of ItGeom which are implemented by the application. State of objects added by method MtGeomSolver::AddGeom remains unchanged.

◆ CreateCluster()

ItGeom* MtGeomSolver::CreateCluster ( std::vector< ItGeom * > &  )

Create an user-defined cluster.

Note
The united objects should not have constraints at the moment of the call. Create a cluster before adding constraints.

◆ FixGeom()

MtResultCode3D MtGeomSolver::FixGeom ( const ItGeom *  )

Freeze a geometric object by making it fixed in the LCS of the supercluster (or the WCS if the latter is not present).

Warning
Deprecated. Use FreezeGeom instead.

◆ IsFixed()

bool MtGeomSolver::IsFixed ( const ItGeom *  )

Check if a geometric object is frozen.

Warning
Deprecated. Use MtGeomSolver::IsFrozen instead.

◆ UnfixGeom()

MtResultCode3D MtGeomSolver::UnfixGeom ( const ItGeom &  )

Free a frozen geometric object.

Warning
Deprecated. MtGeomSolver::FreeGeom instead.

◆ DiagnoseConstraints()

void MtGeomSolver::DiagnoseConstraints ( )

Send out diagnostic codes to constraints.

Solving the constraint system. If it is not solved partly, then by the results of the solution diagnostic codes of errors are sent to all the constraints. The function doesn't have a substantial amount of time if have already tried to solve the constraint system before.

◆ Evaluate()

MtResultCode3D MtGeomSolver::Evaluate ( )

Solve the constraint system.

Changes positions of geometric objects according to geometric constraints.

◆ PrepareReposition() [1/2]

MtResultCode3D MtGeomSolver::PrepareReposition ( ItGeom &  movGeom,
const MbPlacement3D &  projPlane,
const MbCartPoint3D &  curPnt 
)

Initialize mode of object moving in the screen plane.

Parameters
movGeom- Component, part which is manipulated.
projPlane- Plane of the screen given in the WCS of assembly.
curPnt- Point of the component which is projected onto plane of the screen to cursor position and is 'dragging'. curPnt given in the LCS of the geometric object movGeom;
Returns
Result code.


The function runs once before running the dragging mode of components, which is controlled (by movement of the mouse) by the command MtResultCode3D SolveReposition( const MbCartPoint3D & ). Mode is stopped calling any other command other than these two. There is also the special feature. To exit from the dragging mode - void FinishReposition(), for explicit stop of the dragging mode.

◆ PrepareReposition() [2/2]

MtResultCode3D MtGeomSolver::PrepareReposition ( ItGeom &  rotGeom,
const MbCartPoint3D &  org,
const MbVector3D &  axis 
)

Initialize mode of component rotation around a fixed point of axis.

Parameters
geom- The geom object on which is directed at impact.
org,axis- Point and vector in the GCS which define constant axis of rotation.
Returns
Error code, enum #MtResultCode3D
The function runs once before running the rotation mode which is driven by command MtResultCode3D SolveReposition( double alpha ), where "alpha" - input parameter, defines the angular position of the component and given in radians. Mode is stopped by calling void FinishReposition().

◆ SolveReposition() [1/3]

MtResultCode3D MtGeomSolver::SolveReposition ( ItGeom &  gItem,
const MbPlacement3D &  newPos,
MtRepositionMode  movType 
)

Solve the system for an arbitrary change of position of one solid.

Parameters
gItemsolid, the position of which is changed;
newPosnew position of solid g_item;
movTypecode of the desired behavior
Returns
Result code.
Note
This function doesn't allow to take out constraint system from decided state, except when before call of function the system was already unsolved. If new position 'newPos' doesn't allow to satisfy the system of constraints, then new position of solid will be the most nearest to newPos (while preserving solvability).

◆ SolveReposition() [2/3]

MtResultCode3D MtGeomSolver::SolveReposition ( const MbCartPoint3D &  curXYZ)

Solve the system of conjugations for new position of cursor in the dragging mode.

Parameters
-curXYZ the current position of cursor in the WCS.
Returns
Result code.

Work procedure which controls dragging mode which are stopped after call any other command. For example: add a new constraint or rebuild.

◆ SolveReposition() [3/3]

MtResultCode3D MtGeomSolver::SolveReposition ( double  alpha)

Solve the system with the position of the component through one coordinate.

Parameters
alpha- Driving parameter (often, it's in radians ).
Returns
Result code.

This is the work function controls reposition mode, in which the position of the solid is controlled by changing one coordinate. For example the angle of rotation around an axis. Mode is stopped by calling MtGeomSolver::FinishReposition or any other command, which is changes state of the solver. For example MtGeomSolver::AddConstraint. Function for large systems is faster than the Solve(bool) or SolveReposition( ItGeom &, const MbPlacement3D &).

◆ DynamicReposition()

MtResultCode3D MtGeomSolver::DynamicReposition ( ItGeom &  g,
const MbPlacement3D &  manip,
const GCM_dragging &  mode 
)

Drag a geometric object within a system of constraints by repositioning dynamically its manipulator.

Parameters
[in]g- Geometric object subject to dragging.
[in]manip- Initial or target WCS-placement of manipulator.
[in]mode- Dragging mode.
Returns
Result code.

The procedure is intended for serial calls which drag the geometric object in a dynamic manner. The manipulator is bound to the object on the first call and drives it into motion on subsequent ones.

Note
The feauture is under development. The current implementation supports all the presented influence variants (GCM_drag_influence) and the below-noted control values in dependence on the motion option (GCM_drag_motion).
GCM_DRAGGING_RotationZ: #GCM_DRAGGING_Adaptive
GCM_DRAGGING_Translation: #GCM_DRAGGING_Adaptive, #GCM_DRAGGING_Specific
GCM_DRAGGING_TranslationXY: #GCM_DRAGGING_Adaptive
To avoid unexpected behavior, it is recommended to change the target placement of the manipulator between successive calls in accordance with the ordered kind of motion.

Friends And Related Function Documentation

◆ GCM_CreateSolver

SPtr<MtGeomSolver> GCM_CreateSolver ( SPtr< ItPositionManager >  posMan)
friend

Create an object-oriented interface of 3D solver.

Parameters
[in]pMan- Interface that provides functions of reposition of geometric objects on the application side.

The call creates an empty constraint system. Besides, there are created internal data structures of geometric solver maintaining the constraint system. The function returns an instance of class representing an object-oriented interface of the 3D solver.

Returns
Smart-pointer to a new instance of geometric constraint solver.

The documentation for this class was generated from the following file: