C3D Toolkit  Kernel - 117982, Vision -

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...
ItConstraintItemAddConstraint (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...
ItConstraintItemAddConstraint (MtMateType, MtArgument, MtArgument, MtArgument, MtParVariant p1=MtParVariant::undef, MtParVariant p2=MtParVariant::undef)
 Add constraint of three geometric objects.
ItGeomAddGeom (MtGeomVariant)
 Add black box to the constraint system. More...
MtResultCode3D AddBlackbox (ItGCBlackbox &)
ItGeomSetDependentGeom (ItConstraintItem *, ItGeom *)
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...
ItGeomCreateCluster (std::vector< ItGeom * > &)
 Create an user-defined cluster. More...
MtResultCode3D FixGeom (const ItGeom *)
 Fix geometric object in the WCS.
bool IsFixed (const ItGeom *)
 Check if a geometric object is fixed?
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 geometric object from fixation in the WCS.
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 (ItGeom *) const
 Current or calculated position of a geometric object.
const ItGeomCluster (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.
ItGeomGetMovingGeom () 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.
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...
- 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.
ItGeomGround () 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< ItConstraintsEnumGetConstraintsEnum ()
 Get the constraints iterator.
GCM_geom _QueryArgument (const MtArgument &gArg)
const ItGeom_SetDependencyGeom (MtGeomId gId, const ItGeom *gItem)
SPtr< MtGeomSolverGCM_CreateSolver (SPtr< ItPositionManager > posMan)
 Create an object-oriented interface of 3D solver. More...
SPtr< MtGeomSolverGCT_GetSolver (GCM_system gSys)

Detailed Description

Geometric constraint solver.

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

Member Function Documentation

◆ AddConstraintItem()

MtResultCode3D MtGeomSolver::AddConstraintItem ( ItConstraintItem )

Add constraint.

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.

[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.
Geometric constraint.

◆ AddGeom()

ItGeom* MtGeomSolver::AddGeom ( MtGeomVariant  )

Add black box to the constraint system.

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

◆ ChangeGeomPositions()

MtResultCode3D MtGeomSolver::ChangeGeomPositions ( )

Report about position change of conjugated solids.

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.

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

◆ 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.

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;
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.

geom- The geom object on which is directed at impact.
org,axis- Point and vector in the GCS which define constant axis of rotation.
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.

gItemsolid, the position of which is changed;
newPosnew position of solid g_item;
movTypecode of the desired behavior
Result code.
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.

-curXYZ the current position of cursor in the WCS.
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.

alpha- Driving parameter (often, it's in radians ).
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 &).

Friends And Related Function Documentation

◆ GCM_CreateSolver

SPtr<MtGeomSolver> GCM_CreateSolver ( SPtr< ItPositionManager posMan)

Create an object-oriented interface of 3D solver.

[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.

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

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