C3D Toolkit  Kernel - 118072, Vision - 2.18.1.1852
gce_api.h File Reference

Program interface of geometric constraints solver. More...

#include <math_define.h>
#include <gce_types.h>
#include <vector>

Functions

GCE_system GCE_CreateSystem ()
 Create a simple constraint system. More...
 
void GCE_ClearSystem (GCE_system gSys)
 Make the constraint system empty. More...
 
void GCE_RemoveSystem (GCE_system gSys)
 Delete system of constraints. More...
 
geom_item GCE_AddPoint (GCE_system gSys, GCE_point pVal)
 Add point to the constraint system. More...
 
geom_item GCE_AddAxis (GCE_system gSys, const GCE_axis &eVal)
 Add axis to the constraint system. More...
 
geom_item GCE_AddLine (GCE_system gSys, const GCE_line &lVal)
 Add line to the constraint system. More...
 
geom_item GCE_AddLineSeg (GCE_system gSys, geom_item p[2])
 Add a line segment specified by pair of end points to the constraint system. More...
 
geom_item GCE_AddCircle (GCE_system gSys, const GCE_circle &cVal)
 Add circle to the constraint system. More...
 
geom_item GCE_AddEllipse (GCE_system gSys, const GCE_ellipse &eVal)
 Add ellipse to the constraint system. More...
 
geom_item GCE_AddSpline (GCE_system gSys, const GCE_spline &spl)
 Add spline (NURBS) to the constraint system. More...
 
geom_item GCE_AddParametricCurve (GCE_system gSys, const MbCurve &crv)
 Add parametric curve to the constraint system. More...
 
geom_item GCE_AddBoundedCurve (GCE_system gSys, geom_item curve, geom_item p[2])
 Add a curve segment bounded by a pair of points to the constraint system. More...
 
geom_item GCE_AddOffsetCurve (GCE_system gSys, geom_item curve, double offset)
 Add an equidistant curve to the constraint system. More...
 
pattern_item GCE_AddPattern (GCE_system gSys, geom_item geom, double step)
 Declare a pattern with a direction along a line and a given offset or with the center at a point and a given angle. More...
 
pattern_item GCE_AddLinearPattern (GCE_system gSys, GCE_vec2d trans)
 Declare a linear pattern with the step given by the translation vector. More...
 
pattern_item GCE_AddAngularPattern (GCE_system gSys, GCE_point point, double angle)
 Declare an angular pattern with a center and an angle. More...
 
pattern_item GCE_AddSymmetricPattern (GCE_system gSys, geom_item geom)
 Declare a reflection pattern on a linear object. More...
 
pattern_item GCE_AddCompositionPattern (GCE_system gSys, pattern_item pItem1, pattern_item pItem2)
 Declare a composition pattern of two patterns. More...
 
geom_item GCE_AddInstance (GCE_system gSys, pattern_item pItem, geom_item sample, int k)
 Create k-th instance of the sample in a given pattern. More...
 
geom_item GCE_AddInstance (GCE_system gSys, pattern_item pItem, geom_item sample, int i, int j)
 Create (i, j) instance of the sample in a given composition pattern. More...
 
geom_item GCE_AddRigidSet (GCE_system gSys, const std::vector< geom_item > &geoms)
 Add a rigid set of geometric objects to the system. More...
 
var_item GCE_AddVariable (GCE_system gSys, double val)
 Add a variable to the constraint system. More...
 
var_item GCE_VariableOf (GCE_system gSys, geom_item g, coord_type coordType)
 Get a variable from the constraint system. More...
 
constraint_item GCE_AddBound (GCE_system gSys, var_item var, GCE_interval dim)
 Limit the value of a variable to an interval. More...
 
geom_type GCE_GeomType (GCE_system gSys, geom_item g)
 A type of geometric object. More...
 
geom_type GCE_BaseCurveType (GCE_system gSys, geom_item crv)
 A type of geometric curve. More...
 
bool GCE_RemoveVariable (GCE_system gSys, var_item var)
 Delete variable from the constraint system. More...
 
void GCE_ReleaseVariable (GCE_system gSys, var_item var)
 Control variable's lifetime by solver. More...
 
bool GCE_RemoveGeom (GCE_system gSys, geom_item g)
 Delete geometric object from the constraint system. More...
 
void GCE_ReleaseGeom (GCE_system gSys, geom_item g)
 Control geometry object's lifetime by solver. More...
 
bool GCE_RemoveConstraint (GCE_system gSys, constraint_item con)
 Delete a constraint from the system. More...
 
geom_item GCE_PointOf (GCE_system gSys, geom_item g, point_type pnt)
 Request of the object control point descriptor. More...
 
GCE_vec2d GCE_GetVectorValue (GCE_system gSys, geom_item g, subgeom_type vType)
 Get the current coordinates of vector. More...
 
GCE_point GCE_GetPointXY (GCE_system gSys, geom_item g, point_type pName=GCE_PROPER_POINT)
 Get the current coordinates of point. More...
 
double GCE_GetCoordValue (GCE_system gSys, geom_item g, coord_name cName)
 Get the current value of geometric object's coordinate. More...
 
double GCE_GetVarValue (GCE_system gSys, var_item var)
 Get the current value of variable. More...
 
bool GCE_SetPointXY (GCE_system gSys, geom_item g, point_type pName, GCE_point xyVal)
 Set the current coordinates of point. More...
 
bool GCE_SetCoordValue (GCE_system gSys, geom_item g, coord_name cName, double crdVal)
 Set the current value of geometric object's coordinate. More...
 
bool GCE_SetVarValue (GCE_system gSys, var_item var, double val)
 Set the current value of variable. More...
 
void GCE_SetWeight (GCE_system gSys, geom_item spline, size_t pntIdx, double weight)
 Change the weight of the spline control point. More...
 
double GCE_WeightOf (GCE_system gSys, geom_item spline, size_t pntIdx)
 Get the weight of the spline control point. More...
 
geom_item GCE_SplinePoint (GCE_system gSys, geom_item spl, size_t pntIdx)
 Descriptor of spline control point by index. More...
 
geom_item GCE_AddSplinePoint (GCE_system gSys, geom_item spl, size_t pntIdx, GCE_point pnt)
 Add control point to spline (NURBS) More...
 
bool GCE_RemoveSplinePoint (GCE_system gSys, geom_item spl, size_t pntIdx)
 Remove spline (NURBS) control point. More...
 
bool GCE_FreezeGeom (GCE_system gSys, geom_item g)
 Freeze geometric object. More...
 
geom_item GCE_FixOffset (GCE_system gSys, geom_item curve)
 Set the constraint "Fixation of offset". More...
 
bool GCE_IsConstrainedGeom (GCE_system gSys, geom_item g)
 The function answers the question: Is geometric object connected with constraints? More...
 
bool GCE_IsAdjacentConstraint (GCE_system gSys, geom_item g, constraint_item cItem)
 Determine whether the constraint is related to the geometric family of the object. More...
 
bool GCE_HasInstance (GCE_system gSys, pattern_item p)
 The function answers the question: Is there an instance of the pattern? More...
 
bool GCE_IsSatisfied (GCE_system gSys, constraint_item cItem)
 Perform a check that a constraint is satisfied. More...
 
GCE_c_status GCE_ConstraintStatus (GCE_system gSys, constraint_item cItem)
 Status of constraint inn the system. More...
 
GCE_s_state GCE_DefinitionState (GCE_system gSys)
 Get constraint system definition state. More...
 
std::vector< geom_item > GCE_DiagnoseGeometry (GCE_system gcSys)
 
ptrdiff_t GCE_GetPointDOF (GCE_system gSys, geom_item g, point_type cp, double &dofDir)
 Calculate point's degree of freedom. More...
 
GCE_point_dof GCE_PointDOF (GCE_system gSys, geom_item pnt)
 Calculate point's degree of freedom. More...
 
GCE_dof_type GCE_CoordDOF (GCE_system gSys, geom_item g, coord_name cName)
 Get the degree of freedom of geometric coordinate. More...
 
constraint_item GCE_AddUnaryConstraint (GCE_system gSys, constraint_type cType, geom_item geom)
 Set a constraint on single object (unary constraint). More...
 
constraint_item GCE_AddCoincidence (GCE_system gSys, geom_item g[2])
 Set the constraint "Coincidence". More...
 
constraint_item GCE_AddPointOnPercent (GCE_system gSys, geom_item curve, geom_item pnt[3], double k)
 The constraint "Point on a piece of a curve by the coefficient of its parametric range". More...
 
constraint_item GCE_AddPointByMetricPercent (GCE_system gSys, geom_item curve, geom_item pnt[3], double k)
 The constraint "Point on a piece of a curve by the coefficient of its length". More...
 
constraint_item GCE_AddFixCurvePoint (GCE_system gSys, geom_item curve, geom_item pnt)
 Set the constraint "Fixation of location of the point lying on a curve". More...
 
constraint_item GCE_AddPointOnParEllipse (GCE_system gSys, geom_item pnt, geom_item ellipse, double t)
 Set the constraint "Point on parametric ellipse". More...
 
constraint_item GCE_AddParPointOnCurve (GCE_system gSys, geom_item pnt, geom_item curve, var_item t)
 Specify a constraint "Point on curve at a given parameter". More...
 
constraint_item GCE_AddAlignPoints (GCE_system gSys, geom_item p[2], double ang)
 Set the constraint "Alignment of points along the given direction". More...
 
constraint_item GCE_AddAlignPoints (GCE_system gSys, geom_item p[2], geom_item dir)
 Set the constraint "Alignment of points along the given direction". More...
 
constraint_item GCE_AddAngle (GCE_system gSys, geom_item l1, geom_item l2, const GCE_adim_pars &dPars)
 Set the constraint "Angular dimension between two lines". More...
 
constraint_item GCE_AddAngleBisector (GCE_system gSys, geom_item l1, geom_item l2, geom_item bl, GCE_bisec_variant variant)
 Set the constraint "Bisector of angle". More...
 
constraint_item GCE_AddAngle4P (GCE_system gSys, geom_item fPair[2], geom_item sPair[2], const GCE_adim_pars &dPars)
 Specify angular dimension for four points. More...
 
constraint_item GCE_AddColinear (GCE_system gSys, geom_item g[2])
 Set the constraint "Colinearity". More...
 
constraint_item GCE_AddColinear3Points (GCE_system gcSys, geom_item pnt[3])
 Set the constraint "Colinearity of three points". More...
 
constraint_item GCE_AddEqualLength (GCE_system gSys, geom_item curve1, geom_item curve2)
 Set the constraint "Equality of lengths" for curves. More...
 
constraint_item GCE_AddEqualRadius (GCE_system gSys, geom_item c1, geom_item c2)
 Set the constraint "Equality of radii" for two circles (arcs) More...
 
geom_item GCE_AddEqualOffset (GCE_system gSys, geom_item curve1, geom_item curve2)
 Set the constraint "Equal of offset of equidistant curves". More...
 
constraint_item GCE_AddEqualCurvature (GCE_system gSys, geom_item curves[2], var_item tPars[2])
 Specify a constraint "Equality of curvature of two curves at given points". More...
 
constraint_item GCE_AddRadiusDimension (GCE_system gSys, geom_item cir, GCE_dim_pars dPar)
 Specify a "Radius dimension" constraint. More...
 
constraint_item GCE_AddDiameter (GCE_system gSys, geom_item cir, GCE_dim_pars dPar)
 Specify a "Diameter dimension" constraint. More...
 
constraint_item GCE_AddLength (GCE_system gSys, geom_item curve, GCE_dim_pars dPar)
 Specify a "Curve Length" constraint. More...
 
constraint_item GCE_AddPatterned (GCE_system gSys, pattern_item pItem, geom_item sample, geom_item instance, int k)
 Bind two geometric objects by a pattern constraint. More...
 
constraint_item GCE_AddPatterned (GCE_system gSys, pattern_item pItem, geom_item sample, geom_item instance, int i, int j)
 Bind two geometric objects by a pattern constraint. More...
 
constraint_item GCE_FixVariable (GCE_system gSys, var_item var)
 Set the constraint "Driving parameter" or "Fixation of variable". More...
 
constraint_item GCE_FixGeom (GCE_system gSys, geom_item g)
 Set the constraint "Fixation of geom". More...
 
constraint_item GCE_FixLength (GCE_system gSys, geom_item curve)
 Set the constraint "Fixation of curve length". More...
 
constraint_item GCE_FixRadius (GCE_system gSys, geom_item circ, coord_name cName=GCE_RADIUS)
 Set the constraint "Fixation of radius". More...
 
constraint_item GCE_FixCoordValue (GCE_system gSys, geom_item g, coord_name cName)
 Specify fixation of a parametric object coordinate. More...
 
constraint_item GCE_FixSplineDerivative (GCE_system gSys, geom_item spline, double par, uint derOrder, GCE_vec2d *fixVal=nullptr)
 Set the constraint "Fixation of derivative vector of the spline at a given point". More...
 
constraint_item GCE_AddMiddlePoint (GCE_system gcSys, geom_item pnt[3])
 Set the constraint "Middle point". More...
 
constraint_item GCE_AddParallel (GCE_system gSys, geom_item g[2])
 Set the constraint "Parallelism". More...
 
constraint_item GCE_AddPerpendicular (GCE_system gSys, geom_item g[2])
 Set the constraint "Perpendicularity". More...
 
constraint_item GCE_AddSymmetry (GCE_system gSys, geom_item g[2], geom_item lObj)
 Set the constraint "Symmetry relative to the linear object". More...
 
constraint_item GCE_AddTangent (GCE_system gSys, geom_item g[2], var_item tPar[2])
 Set the constraint "Tangency of two curves". More...
 
constraint_item GCE_AddDistance (GCE_system gSys, geom_item g[2], const GCE_ldim_pars &dPars)
 Set the dimensional constraint "Distance between objects". More...
 
constraint_item GCE_AddDistance2P (GCE_system gSys, geom_item p[2], const GCE_dim_pars &dPars)
 Set the constraint "Distance between points". More...
 
constraint_item GCE_AddDistancePLs (GCE_system gSys, geom_item p[3], const GCE_dim_pars &dPars)
 Set the constraint "Distance from a point to a segment". More...
 
constraint_item GCE_AddLinearDimension (GCE_system gSys, geom_item geoms[2], const GCE_ldim_config &dPars)
 Add the linear dimension to the constraint system. More...
 
constraint_item GCE_AddLinearEquation (GCE_system gSys, const double *a, const var_item *v, size_t n, double c)
 Set the linear equation. More...
 
GCE_alignment GCE_SetAlignment (GCE_system gSys, constraint_item constraint, GCE_alignment alignment=GCE_AUTO_ALIGNMENT)
 Set the tangent orientation. More...
 
GCE_result GCE_ChangeDrivingDimension (GCE_system gSys, constraint_item dItem, double dVal)
 Change the value of driving dimension. More...
 
GCE_result GCE_DeviationTest (GCE_system gSys, constraint_item dItem, double delta)
 Redundancy test based on deviating a constraint from the solution point. More...
 
double GCE_DimensionParameter (GCE_system gSys, constraint_item dItem)
 A current value of the dimension parameter. More...
 
GCE_result GCE_Evaluate (GCE_system gSys)
 Calculate the constraint system. More...
 
GCE_result GCE_PrepareMovingOfPoint (GCE_system gSys, geom_item obj, point_type pntId, GCE_point curXY)
 Initialize the dragging mode of the object control point. More...
 
GCE_result GCE_PrepareDraggingPoint (GCE_system gSys, GCE_dragging_point drgPnt, GCE_point curXY)
 Initialize the dragging mode of the object control point. More...
 
GCE_result GCE_PrepareDraggingPoint (GCE_system gSys, const std::vector< GCE_dragging_point > &cPntArr, GCE_point curXY)
 Initialize the dragging mode of the control point of object set. More...
 
GCE_result GCE_PrepareMovingGeoms (GCE_system gSys, std::vector< geom_item > &geoms, GCE_point curXY)
 Initialize mode of moving a set of objects. More...
 
GCE_result GCE_MovePoint (GCE_system gcSys, GCE_point curXY)
 Move a dragging point. More...
 
GCE_result GCE_DynamicTransform (GCE_system gSys, const std::vector< geom_item > &geoms, const MbMatrix &mat)
 
GCE_result GCE_Transform (GCE_system gSys, const MbMatrix &mat)
 
bool GCE_SetJournal (GCE_system gSys, const char *fName)
 Switch on the journalling and specify the file for recording a journal of GCE API calls. More...
 
GCE_journal GCE_SubscribeJournal (GCE_system gSys, GCE_log_func logFunc, GCE_extra_param extParam)
 Get a logger that recording API calls, as well as other events related to interaction with the solver. More...
 
GCE_result GCE_DeviateDimension (GCE_system gSys, constraint_item dItem, double delta)
 This call is deprecated and will be removed in one of the next versions. Instead, call GCE_DeviationTest to evaluate redundancy and GCE_ChangeDrivingDimension to change dimension value.
 
bool GCE_DeviateDimension (GCE_system gSys, constraint_item dItem, double delta, GCE_result &errCode)
 An obsolete function. The call will be removed in one of the next versions. It's recommended to use new version of this function: GCE_DeviateDimension( GCE_system gSys, constraint_item dItem, double delta )
 
bool GCE_DeviationTest (GCE_system gSys, constraint_item dItem, double delta, GCE_result &errCode)
 An obsolete function. The call will be removed in one of the next versions. It's recommended to use new version of this function: GCE_DeviationTest( GCE_system gSys, constraint_item dItem, double delta )
 
geom_item GCE_AddPoint (GCE_system gSys, GCE_point pVal, int)
 
constraint_item GCE_AddDirectedDistance (GCE_system gSys, geom_item p[2], const GCE_ldim_pars &dPars)
 
constraint_item GCE_AddDirectedDistance2P (GCE_system gSys, geom_item p[2], const GCE_ldim_pars &dPars)
 
constraint_item GCE_AddAlignPoints (GCE_system gSys, geom_item p[2], bool hor)
 
constraint_item GCE_AddFixedLength (GCE_system, geom_item)
 
constraint_item GCE_AddFixVariable (GCE_system, var_item)
 
constraint_item GCE_AddIncidence (GCE_system, geom_item, geom_item)
 Set the constraint "Point on curve". More...
 

Detailed Description

Program interface of geometric constraints solver.

A program interface of geometric solver represents a set of data types and functions necessary for solution of a problem of geometric constraints. Subject area of the solver provides such types as "geometric object", "geometric constraint", "constraint system". Base types of the solver are declared in the header file <gce_types.h>. Calls of functions and their arguments are chosen in such way that the formulation of the problem for the solver in terms of objects and constraints could be performed by the most convenient way. The names of many data types and API calls begins with a prefix 'GCE', abbreviation for Geometric Constraint Engine.
API functions of solver can be subdivided into the following groups: 1) Functions GCE_CreateSystem, GCE_ClearSystem, GCE_RemoveSystem allow to create and delete the system of constraints in general (should be called in sequential code);
2) The problems of constraints are formulated with a function of a kind GCE_Add_XXXXXXX, by using them the objects and constraints are added to the system (could be called in multi-threaded mode);
3) Functions of a kind GCE_Change_XXXXXXX, GCE_Set_XXXXXXX allow to change dimensions and objects states (could be called in multi-threaded mode);
4) Functions for requests, such as #GCE_Get_XXXXXXX, GCE_SplinePoint, #GCE_IsXXXXX, GCE_PointDOF etc, allow to perform requests about the states of objects or their properties, find the objects degree of freedom and other characteristics could be called in multi-threaded mode;
5) The method GCE_Evaluate calculates the state of the constraint system, where all constraints are satisfied or returns an error code if it is not possible to find a solution (should be called in sequential code).
6) Other group of calls responses for the ways of control of underdetermined system of constraints. Calls of GCE_PrepareDraggingPoint, GCE_MovePoint provide interactive manipulation with objects of drawing/sketch.