C3D Kernel  104598
Algorithms in Two-Dimensional Space
Geometric Construction Methods
Collaboration diagram for Algorithms in Two-Dimensional Space:

Classes

class  MbDistance
Distance between objects. More...
class  DiskreteLengthData
Data for support of discrete length/radius/distance. More...
class  MpVertex
Vertex. More...
class  MpEdge
Edge. More...
class  MpLoop
Loop. More...
class  MpGraph
Contours construction graph. More...
class  MbBreaksPart
Part of break. More...
class  MbBreak
Break. More...
class  MbTri
Triangle. More...
class  MbPlanarGrid
Triangulation of a two-dimensional region. More...
struct  StMLTipParams
Tip parameters structure. More...
struct  StVertexOfMultilineInfo
class  MbBreaksRebuild
Class for breaks rebuilding. More...

Enumerations

enum  MbeIntLoopsResult {
ilr_error = -1, ilr_notIntersect = 0, ilr_firstCurve = 1, ilr_secondCurve = 2,
ilr_success = 3
}
The curves intersection result. More...
enum  EnMLVertexTracingType { mvt_ShearType, mvt_FilletType, mvt_SpecFilletType }
Type of traverse of corners. More...
enum  EnMLInnerTipType { mit_UndefTip, mit_VerticesTip, mit_LinearTip, mit_ArcTip }
Type of inner tip. More...
enum  EnMLTipType {
mtt_UndefTip, mtt_LinearTip, mtt_ArcTip, mtt_PolylineTip,
mtt_ObliqueTip
}
Type of tip. More...

Functions

MbeItemLocation SecondContourLocation (const MbContour &contour1, const MbContour &contour2, double xEpsilon, double yEpsilon)
Classify the position of the second contour relative to the first one.
bool IsSpaceNear (const MbCurve &curve1, const MbCurve &curve2, double xEpsilon, double yEpsilon, double devSag=5.0 *Math::deviateSag)
Determine whether the first curve is close to the second curve.
bool ChangeFirstPoint (MbCurve *segment, const MbCartPoint &p1)
Correct the start point.
bool ChangeLastPoint (MbCurve *segment, const MbCartPoint &p2)
Correct the last point.
double c3d::CalcAngle0X (double dx, double dy)
Calculate angle between line and 0X-axis.
long double c3d::CalcAngle0X (long double dx, long double dy)
Calculate the angle between a line and 0X-axis.
double c3d::CalcAngle0X (const MbCartPoint &p1, const MbCartPoint &p2)
Calculate the angle between a line and 0X-axis.
void c3d::AngleToParam (double dir, bool left, double &t)
Transform a circle angle to the curve parameter.
double c3d::CalcAngle3Points (const MbCartPoint &p1, const MbCartPoint &centre, const MbCartPoint &p3)
Calculate the minimal angle between lines.
MbCartPoint c3d::LineSegDivide (const MbCartPoint &p1, const MbCartPoint &p2)
Split segment by the middle.
MbeState DeleteCurvePart (List< MbCurve > &curveList, const MbCartPoint &pnt, MbCurve *curve, MbCurve *&part2)
Delete the piece of a curve.
MbeState DeleteCurvePart (const MbCartPoint &p1, const MbCartPoint &p2, const MbCartPoint &p3, MbCurve *curve, MbCurve *&part2)
Delete the piece of a curve.
MbeState TrimmCurvePart (List< MbCurve > &curveList, const MbCartPoint &pnt, MbCurve *curve, MbCurve *&part2)
Keep the piece of a curve.
MbeState TrimmCurvePart (const MbCartPoint &p1, const MbCartPoint &p2, const MbCartPoint &p3, MbCurve *curve, MbCurve *&part2)
Keep the piece of a curve.
MbeState JustifyCurve (MbCurve *curve, MbCurve *limitCurve, const MbCartPoint &pnt, MbCurve *&part2)
Justify the curve.
MbeLocation PointLocation (const RPArray< const MbCurve > &limits, const MbCartPoint &pnt)
The position of the point.
MbeState BreakByClosedCurves (MbCurve &curve, const RPArray< const MbCurve > &limits, bool inside, PArray< MbCurve > &part2, SArray< MbCrossPoint > *cross=NULL, bool *isEqualCurve=NULL, bool cutOnCurve=false)
Exclude the piece of a curve.
MbeState BreakByCurvesArr (MbCurve &curve, const RPArray< const MbCurve > &limits, PArray< MbCurve > &part2)
Exclude the piece of a curve.
MbeState BreakCurve (MbCurve &curve, const MbCartPoint &p1, const MbCartPoint &p2, PArray< MbCurve > &part2)
Split the curve.
MbeState BreakCurveNParts (MbCurve &curve, ptrdiff_t partsCount, const MbCartPoint &p1, PArray< MbCurve > &part2)
Split the curve.
MbeState ExtendCurveToCurve (MbCurve *curve, const MbCurve *limitCurve, const MbCartPoint &pnt)
Extend the curve.
int Circle2PointsRadius (const MbCartPoint &p1, const MbCartPoint &p2, double radius, MbTempCircle *circle)
Calculate a circle center.
bool CircleCentre3Points (const MbCartPoint &p1, const MbCartPoint &p2, const MbCartPoint &p3, MbCartPoint &centre)
Calculate center and radius of a circle.
bool DistanceCurveCurve (const MbCurve &curve1, const MbCurve &curve2, MbDistance &dmin)
Calculate distance.
void CalculateUV (const MbCurve &curve1, const MbCurve &curve2, double &u, double &v)
Calculate parameters of curves.
bool PointsOnCurve (ptrdiff_t count, const MbCartPoint &on, const MbCurve &curve, SArray< MbCartPoint > &points, SArray< double > &pars)
Put points on a curve.
MbCurveFatArcContour (const MbCurve &curve, double eps, double maxRadius, bool mate, VERSION version=Math::DefaultMathVersion())
Approximation of a curve by arcs and segments.
bool BeginEnvelopeContour (MbCartPoint &insidePnt, const MbCurve *selectCurve, SArray< MbCrossPoint > &cross, MbContour &contour, SArray< MbCrossPoint > &crossRight)
Find the first segment of a contour.
MbCurveFindNearestCurve (List< MbCurve > &curveList, MbCartPoint &pnt)
Find the nearest curve.
void IntersectWithAll (const MbCurve *selectCurve, LIterator< MbCurve > &fromCurve, SArray< MbCrossPoint > &cross, bool self)
Find intersection points.
void SortCrossPoints (double tProj, const MbCurve *selectCurve, SArray< MbCrossPoint > &cross, SArray< MbCrossPoint > &crossLeft, SArray< MbCrossPoint > &crossRight)
Sort intersection points.
void RemoveEquPoints (double tProj, SArray< MbCrossPoint > &cross)
Delete coincident points.
void Equid (const MbCurve *curve, double radLeft, double radRight, int side, bool arcMode, bool degState, PArray< MbCurve > &equLeft, PArray< MbCurve > &equRight)
Construction of offset curves to a curve.
void MakeHatchingArea (const PArray< MbCurve > &contour, double witdh, PArray< MbCurve > &borders)
Construction of curves hatching region.
bool Fillet (MbCurve *curve1, const MbCartPoint &pnt1, bool trim1, MbCurve *curve2, const MbCartPoint &pnt2, bool trim2, double rad, MbeState &state1, MbeState &state2, MbArc *&arc)
Construct fillet between curves.
bool Chamfer (MbCurve *curve1, const MbCartPoint &pnt1, bool trim1, MbCurve *curve2, const MbCartPoint &pnt2, bool trim2, double len, double angle, bool type, MbeState &state1, MbeState &state2, MbLineSegment *&lineseg)
Construct a chamfer.
MbeState FilletPolyContour (MbCurve *mc, double rad, bool nodeFlag, const MbCartPoint &pnt, MbContour *&contour)
Construct a fillet.
bool ChamferPolyContour (MbCurve *mc, double l1, double par, bool chamferTypeFlag, bool nodeFlag, const MbCartPoint &pnt)
Construct a chamfer.
bool Corner (MbCurve *crv1, MbCurve *crv2, const MbCartPoint &p1, const MbCartPoint &p2)
Extend curves.
void HatchIntersectLine (double y, MbCurve *curve, SArray< MbCartPoint > &crossPnt)
Find intersection with horizontal line.
void HatchIntersectCircle (MbCurve *circle, MbCurve *curve, SArray< MbCartPoint > &crossPnt)
Find intersection with a circle.
double CurveRelative (const MbCurve &curve, const MbCartPoint &p1, const MbCartPoint &p2)
The location of a curve relative to axis points.
double ContourRelative (const MbCurve &curve, const MbCartPoint &p1, const MbCartPoint &p2, double sag)
A sign of area of a curve's shadow on a segment.
DEPRECATE_DECLARE MbeIntLoopsResult BooleanIntLoops (const MbCurve &loop1, bool bOrient1, const MbCurve &loop2, bool bOrient2, RPArray< MbCurve > &intLoops)
Calculate two curves intersection.
bool RemoveContourGaps (MbContour &contour, double accuracy, bool canInsert, bool canReplace)
Remove contour gaps.
MpGraphEncloseContoursBuilder (const RPArray< MbCurve > &curveList, const MbCartPoint &p, PArray< MbCurve > &usedCurves, PArray< MbContour > &contourArray, double accuracy, bool strict, VERSION version, IProgressIndicator *progInd=NULL)
Create contours around the given point.
MpGraphOuterContoursBuilder (const RPArray< MbCurve > &curveList, PArray< MbContour > &contourArray, double accuracy, bool strict, VERSION version, IProgressIndicator *progInd=NULL)
Construct enclosing contours on the basis of the given curves.
MpGraphContoursReconstructor (const RPArray< MbCurve > &curveList, MpGraph *graph, PArray< MbContour > &contourArray, double accuracy, bool strict, VERSION version, IProgressIndicator *progInd=NULL)
Reconstruct contours constructed around the point before.
void NearPointProjections (const MbContour &contour, const MbCartPoint &pnt, SArray< double > &tProjs, bool isNear, double mEps=METRIC_REGION)
Nearest projections on the contour.
MbeNewtonResult NearestPoints (const MbCurve &curve1, bool ext1, const MbCurve &curve2, bool ext2, double xEpsilon, double yEpsilon, double &t1, double &t2, double &dmin, VERSION version=Math::DefaultMathVersion())
Calculate parameters of the nearest points of two curves.
double AreaSign (const MbCurve &curve, double sag, bool close)
An area and orientation of a closed curve.
template<class Point >
bool c3d::EqualPoints (const Point &p1, const Point &p2, double xEpsilon, double yEpsilon)
Check points for equality.
template<class Vector >
bool c3d::EqualVectors (const Vector &p1, const Vector &p2, double xEpsilon, double yEpsilon)
Check equality of vectors with given tolerance.
bool c3d::EqualLengths (double lx, double ly, double minLen=METRIC_EPSILON, double minDev=LENGTH_EPSILON)
Check lengths for equality.
bool FilletMultiline (MbMultiline &multiline, double rad, bool nodeFlag, MbCartPoint &pnt, const StVertexOfMultilineInfo &vertInfo)
Construct a fillet of multiline.
bool ChamferMultiline (MbMultiline &multiline, double len, double par, bool type, bool nodeFlag, MbCartPoint &pnt, const StVertexOfMultilineInfo &vertInfo)
Construct a chamfer of multiline.
void ToTakeIntoCurvesCrvRadii (MbCurve &curve, double angle, double &minPos, double &maxNeg)
Out-of-class functions for curvature radii calculation/consideration (implementation in MltLine.cpp)
void GetContoursCrvRadii (MbContour &contour, double angle, double &minPos, double &maxNeg)
bool SmoothJointSuccessiveCurves (MbCurve &curve1, MbCurve &curve2)
Join two curves.
bool BreakMultiline (const MbMultiline &multiline, const MbCartPoint &p1, const MbCartPoint &p2, PArray< MbMultiline > &parts)
Split multiline.
bool BreakMultilineNParts (const MbMultiline &multiline, size_t partsCount, const MbCartPoint &point, PArray< MbMultiline > &parts)
Split multiline.
void GetCorrectRegions (const RPArray< MbContour > &contours, bool sameContours, RPArray< MbRegion > &regions)
Get a set of regions.
void MakeRegions (RPArray< MbContour > &contours, bool useSelfIntCntrs, bool sameContours, RPArray< MbRegion > &regions)
Divide a set of regions into groups and construct regions.
bool CreateBooleanResultRegions (RPArray< MbContour > &contours1, RPArray< MbContour > &contours2, const MbRegionBooleanParams &operParams, RPArray< MbRegion > &regions, MbResultType *resInfo=NULL)
Perform boolean operation with regions.
bool CreateBooleanResultRegions (MbRegion &region1, MbRegion &region2, const MbRegionBooleanParams &operParams, RPArray< MbRegion > &regions, MbResultType *resInfo=NULL)
Perform boolean operation with regions.
bool MakeUnionRegions (RPArray< MbRegion > &regions, bool allowSelfTouch=true, bool mergeCurves=true)
Perform union of regions.

Enumeration Type Documentation

 enum MbeIntLoopsResult

The result of two curves' regions intersection.

Enumerator:
 ilr_error Error! Curves are not closed or have self-intersections. ilr_notIntersect Regions of curves don't have intersections (intersection curve array is empty). ilr_firstCurve The intersection of regions is the first curve (intersection curve array is empty). ilr_secondCurve The intersection of regions is the second curve (intersection curve array is empty). ilr_success An arbitrary intersection (one or more curves in intersection curve array).

Type of traverse of corners at a vertex of multiline.

Enumerator:
 mvt_ShearType Traverse by shear. mvt_FilletType Traverse by fillet. mvt_SpecFilletType Traverse by fillet with a given radius.
 enum EnMLInnerTipType

Type of inner tip of multiline.

Enumerator:
 mit_UndefTip No tip. mit_VerticesTip Tip between corresponding vertices. mit_LinearTip Linear tip. mit_ArcTip Arc tip.
 enum EnMLTipType

Type of tip of multiline.

Enumerator:
 mtt_UndefTip No tip. mtt_LinearTip Linear tip. mtt_ArcTip Arc tip. mtt_PolylineTip Polyline tip. mtt_ObliqueTip Inclined tip.

Function Documentation

 MbeItemLocation SecondContourLocation ( const MbContour & contour1, const MbContour & contour2, double xEpsilon, double yEpsilon )

Classify the position of the second contour relative to the first one:
iloc_OutOfItem - outside,
iloc_OnItem - intersects,
iloc_InItem - inside.

Parameters:
 [in] contour1 - The first contour. [in] contour2 - The second contour. [in] xEpsilon - Tolerance in x direction. [in] yEpsilon - Tolerance in y direction.
Returns:
Returns the result of classification of the relative position.
 bool IsSpaceNear ( const MbCurve & curve1, const MbCurve & curve2, double xEpsilon, double yEpsilon, double devSag = `5.0 *Math::deviateSag` )

Determine whether curve 'curve1' is close to curve 'curve2' within the given precision.
The proximity is defined by the closeness of points of the first curve obtained by sampling
with the given turning angle to the second curve.

Parameters:
 [in] curve1 - The first curve. [in] curve2 - The second curve. [in] xEpsilon - Proximity tolerance in x direction. [in] yEpsilon - Proximity tolerance in y direction. [in] devSag - The maximal turning angle for sampling the curve.
Returns:
Returns 'true' if the curves are close.
 bool ChangeFirstPoint ( MbCurve * segment, const MbCartPoint & p1 )

Change the start point of curve with a new one.
Changes the start point for curves of types:
pt_Nurbs, pt_Hermit, pt_Polyline, pt_Bezier, pt_CubicSpline, pt_LineSegment, pt_ReparamCurve,
or for contour pt_Contour if its first segment is of one of the listed types.

Parameters:
 [in] segment - The modified curve. [in] p1 - A new start point.
 bool ChangeLastPoint ( MbCurve * segment, const MbCartPoint & p2 )

Change the end point of curve with a new one.
Changes the end point for curves of types:
pt_Nurbs, pt_Hermit, pt_Polyline, pt_Bezier, pt_CubicSpline, pt_LineSegment, pt_ReparamCurve,
or for contour pt_Contour if its last segment is of one of the listed types.

Parameters:
 [in] segment - The modified curve. [in] p1 - A new start point.
 double c3d::CalcAngle0X ( double dx, double dy ) ` [inline]`

Line is set by dx and dy increments. Angle is in range [0, 2*M_PI).

Parameters:
 [in] dx - Increment along X. [in] dy - Increment along Y.
Returns:
The required angle.
 long double c3d::CalcAngle0X ( long double dx, long double dy ) ` [inline]`

A line is defined by dx and dy increments. The angle is in range [0, 2*M_PI).

Parameters:
 [in] dx - Increment along X. [in] dy - Increment along Y.
Returns:
The required angle.
 double c3d::CalcAngle0X ( const MbCartPoint & p1, const MbCartPoint & p2 ) ` [inline]`

Line is defined by two points. The angle is in range [0, 2*M_PI].

Parameters:
 [in] p1 - The first point. [in] p2 - The second point
Returns:
The required angle.
 void c3d::AngleToParam ( double dir, bool left, double & t ) ` [inline]`
Parameters:
 [in] dir - Angle between X-axes of a circle and of the coordinate system. [in] left - If true, then the coordinate system is left, otherwise it is right. [out] t - Parameter to transform.
 double c3d::CalcAngle3Points ( const MbCartPoint & p1, const MbCartPoint & centre, const MbCartPoint & p3 ) ` [inline]`

Lines are specified as follows: l1( centre, p1 ) and l2( centre, p3 ).

Parameters:
 [in] p1 - A point on the first line. [in] centre - The common point of two lines. [in] p3 - A point on the second line.
Returns:
Signed result:
"+" - p3 lies to the left of vector ( centre, p1 ); "-" - p3 lies to the right of vector ( centre, p1 ).
 MbCartPoint c3d::LineSegDivide ( const MbCartPoint & p1, const MbCartPoint & p2 ) ` [inline]`
Parameters:
 [in] p1 - Coordinates of the segment's start point. [in] p2 - Coordinates of the segment's end point.
Returns:
Coordinates of the segment's middle point.
 MbeState DeleteCurvePart ( List< MbCurve > & curveList, const MbCartPoint & pnt, MbCurve * curve, MbCurve *& part2 )

Delete a piece of a curve by the point.
Delete the piece bounded by two successive parameters of intersection of the curve with the curves from the given list and the nearest to the projection of the given point.

Parameters:
 [in] curveList - The list of curves for intersection. [in] pnt - The point indicating the piece of a curve to be deleted. [in,out] curve - The curve to be modified. [out] part2 - The finite piece of the modified curve if the curve is split into two pieces.
Returns:
The state of a curve after modification.
 MbeState DeleteCurvePart ( const MbCartPoint & p1, const MbCartPoint & p2, const MbCartPoint & p3, MbCurve * curve, MbCurve *& part2 )

Delete the piece of a curve by two points.
The third point is additionally specified for closed curves, it indicates the piece of a curve to be deleted.

Parameters:
 [in] p1 - The point indicating the first boundary of the piece to be deleted. [in] p2 - The point indicating the second boundary of the piece to be deleted. [in] p3 - The point indicating the piece of a closed curve to be deleted. [in,out] curve - The curve to be modified. [out] part2 - The finite piece of the modified curve if the curve is split into two pieces.
Returns:
The state of a curve after modification.
 MbeState TrimmCurvePart ( List< MbCurve > & curveList, const MbCartPoint & pnt, MbCurve * curve, MbCurve *& part2 )

Keep the piece of a curve by the point. Keep the curve piece bounded by two successive parameters of intersection of the initial curve with the curves from the given list and the nearest to the projection of the given point.

Parameters:
 [in] curveList - The list of curves for intersection. [in] pnt - The point indicating the piece of a curve to be kept. [in,out] curve - The curve to be modified. [in,out] part2 - This value is always NULL.
Returns:
The state of a curve after its modification.
Warning:
For internal use only.
 MbeState TrimmCurvePart ( const MbCartPoint & p1, const MbCartPoint & p2, const MbCartPoint & p3, MbCurve * curve, MbCurve *& part2 )

Keep the piece of a curve by two points.
The third point is additionally specified for closed curves, it indicates the piece of a curve to be kept.

Parameters:
 [in] p1 - The point indicating the first boundary of the piece to be deleted. [in] p2 - The point indicating the second boundary of the piece to be deleted. [in] p3 - The point indicating the piece of a closed curve to be kept [in,out] curve - The curve to be modified. [in,out] part2 - This value is always NULL.
Returns:
The state of a curve after its modification.
Warning:
For internal use only.
 MbeState JustifyCurve ( MbCurve * curve, MbCurve * limitCurve, const MbCartPoint & pnt, MbCurve *& part2 )

Justify the curve relative to the given curve and a point on the curve.
The curve is truncated by the point of its intersection with the boundary curve, which is the nearest to the given point. Only the piece of a curve at the side of the given point is kept.

Parameters:
 [in,out] curve - The modified curve. [in] limitCurve - Boundary curve for justification. [in] pnt - The point for selecting the piece of a curve. [in,out] part2 - This value is always NULL.
Returns:
The state of a curve after modification.
Warning:
For internal use only.
 MbeLocation PointLocation ( const RPArray< const MbCurve > & limits, const MbCartPoint & pnt )

The position of the point relative to closed borders.

Parameters:
 [in] limits - The set of curves that defines boundaries. These curves should be closed boundaries in the aggregate. [in] pnt - The point for the position definition.
Returns:
The point position relative to the curve.
 MbeState BreakByClosedCurves ( MbCurve & curve, const RPArray< const MbCurve > & limits, bool inside, PArray< MbCurve > & part2, SArray< MbCrossPoint > * cross = `NULL`, bool * isEqualCurve = `NULL`, bool cutOnCurve = `false` )

Exclude curve pieces from closed boundaries.

Parameters:
 [in] curve - The bounded curve. [in] limits - The array of closed curves-boundaries. [in] inside - The attribute of deletion inside boundaries. [out] part2 - The array of remaining curve pieces. [out] cross - The curve and boundaries intersection point. [out] isEqualCurve - The attribute of coincidence between the broken curve with one of the given array of boundaries. It is worthwhile if the result is dp_NoChanged. [in] cutOnCurve - If it equals to false, then the pieces of a curve coincident with pieces of the boundary are not to be deleted.
Returns:
The state of a curve after modification.
 MbeState BreakByCurvesArr ( MbCurve & curve, const RPArray< const MbCurve > & limits, PArray< MbCurve > & part2 )

Exclude pieces of a curve by coincidence with curves from a set.

Parameters:
 [in] curve - The bounded curve. [in] limits - The array of curves for the hit testing. [out] part2 - The array of remaining curve pieces.
Returns:
The state of a curve after modification.
 MbeState BreakCurve ( MbCurve & curve, const MbCartPoint & p1, const MbCartPoint & p2, PArray< MbCurve > & part2 )

Split the curve into two pieces. In result the curve is split into pieces. The first piece remains, the other pieces are added to the array part2.

Returns:
The state of a curve after modification.
Parameters:
 [in,out] curve - The curve for splitting. [in] p1 - The first point of splitting. [in] p2 - The second point of splitting. [out] part2 - The array of curve pieces.
Returns:
The state of a curve after modification.
 MbeState BreakCurveNParts ( MbCurve & curve, ptrdiff_t partsCount, const MbCartPoint & p1, PArray< MbCurve > & part2 )

Split the curve by several equal pieces.

Parameters:
 [in,out] curve - The curve for splitting. [in] partsCount - The count of pieces. [in] p1 - One of splitting points. [out] part2 - The array of curve pieces.
Returns:
The state of a curve after modification.
 MbeState ExtendCurveToCurve ( MbCurve * curve, const MbCurve * limitCurve, const MbCartPoint & pnt )

Extend the curve to the given curve-boundary limitCurve from the end nearest to the given point pnt.

Parameters:
 [in,out] curve - The modified curve. [in] limitCurve - The curve-boundary [in] pnt - The point indicating the extended end of a curve.
Returns:
The state of a curve after modification.
 int Circle2PointsRadius ( const MbCartPoint & p1, const MbCartPoint & p2, double radius, MbTempCircle * circle )

Calculate a circle center by two points and radius.

Parameters:
 [in] p1 - The first point. [in] p2 - The second point. [in] radius - Radius. [out] circle - The result - the array of temporary circles.
Returns:
The count of elements in the array "circle".
 bool CircleCentre3Points ( const MbCartPoint & p1, const MbCartPoint & p2, const MbCartPoint & p3, MbCartPoint & centre )

Calculate center and radius of a circle by three points.

Parameters:
 [in] p1 - The first point. [in] p2 - The second point. [in] p3 - The third point. [out] centre - The result - the circle center.
Returns:
true if the construction is possible.
 bool DistanceCurveCurve ( const MbCurve & curve1, const MbCurve & curve2, MbDistance & dmin )

Calculate distance between two curves.

Parameters:
 [in] curve1 - The first curve. [in] curve2 - The second curve. [out] dmin - The result - the distance between curves.
Returns:
true if curves do not intersect. false if curves intersect.
 void CalculateUV ( const MbCurve & curve1, const MbCurve & curve2, double & u, double & v )

Calculate curves parameters for the minimal distance.

Parameters:
 [in] curve1 - The first curve. [in] curve2 - The second curve. [out] u - Parameter on the first curve. [out] v - Parameter on the second curve.
 bool PointsOnCurve ( ptrdiff_t count, const MbCartPoint & on, const MbCurve & curve, SArray< MbCartPoint > & points, SArray< double > & pars )

Put a given number of points on curve.
Points may be put only on a bounded curve.

Parameters:
 [in] count - The number of points. [in] on - Projection of this point will be added in the result in a case of closed curve. [in] curve - The curve. [out] points - Points on the curve. [out] pars - Parameters on the curve.
Returns:
true if points were calculated.
 MbCurve* FatArcContour ( const MbCurve & curve, double eps, double maxRadius, bool mate, VERSION version = `Math::DefaultMathVersion()` )

Approximation of a curve by arcs and segments.

Parameters:
 [in] curve - The curve for approximation. [in] eps - The metric tolerance. [in] maxRadius - The minimal approximation radius. [in] mate - The approximation flag with consideration of conjugations. [in] version - The version of construction.
 bool BeginEnvelopeContour ( MbCartPoint & insidePnt, const MbCurve * selectCurve, SArray< MbCrossPoint > & cross, MbContour & contour, SArray< MbCrossPoint > & crossRight )

Find the first segment of a contour.
A piece of the curve "selectCurve" between intersection parameters is added in contour, the parameters are the nearest to the projection of the point "insidePoint".

Parameters:
 [in] insidePnt - The point around which to create the contour. [in] selectCurve - The nearest curve. [in] cross - The array of points of intersection with the nearest curve. [out] contour - The contour for adding the segment to. [out] crossRight - The node - the array of intersection points in the side of contour extension.
Returns:
true if a segment has been added.
 MbCurve* FindNearestCurve ( List< MbCurve > & curveList, MbCartPoint & pnt )

Find the curve nearest to a point.

Parameters:
 [in] curveList - The list of curves. [in] pnt - The point.
Returns:
The nearest curve.
 void IntersectWithAll ( const MbCurve * selectCurve, LIterator< MbCurve > & fromCurve, SArray< MbCrossPoint > & cross, bool self )

Find intersection points of the chosen curve with the other curves from the list.

Parameters:
 [in] selectCurve - The curve. [in] fromCurve - The iterator of the curves list. [out] cross - Intersection points. [in] self - Flag of self-intersections search.
 void SortCrossPoints ( double tProj, const MbCurve * selectCurve, SArray< MbCrossPoint > & cross, SArray< MbCrossPoint > & crossLeft, SArray< MbCrossPoint > & crossRight )

Sort intersection points relative to the projection point of the chosen curve.

Parameters:
 [in] tProj - Parameter of the projection on the curve. [in] selectCurve - The curve. [in,out] cross - The array of intersection points for sorting. [out] crossLeft - The node of intersection points on the left of the projection. [out] crossRight - The node of intersection points on the right of the projection.
 void RemoveEquPoints ( double tProj, SArray< MbCrossPoint > & cross )

Delete points from the array which are coincident with the projection point specified by the parameter.
If all the points are coincident with the projection point, then they will not be deleted.

Parameters:
 [in] tProj - The projection parameter. [in,out] cross - The array of intersection points.
 void Equid ( const MbCurve * curve, double radLeft, double radRight, int side, bool arcMode, bool degState, PArray< MbCurve > & equLeft, PArray< MbCurve > & equRight )

Construction of equidistant curves to arbitrary curve on the right and on the left. A name of every offset contour matches with the name of the initial one.

Parameters:
 [in] curve - The initial curve [in] radLeft - The equidistance radius on the left by direction. [in] radRight - The equidistance radius on the right by direction. [in] side - Attribute defining the side to construct: 0 - on the left by derection, 1 - on the right by derection, 2 - on the both sides. [in] arcMode - The way of traverse of angles: true - by arc, false - by section. [in] degState - Attribute of degenerate segments allowance: 0 - degenerate segments are forbidden, 1 - degenerate segments are allowed. [out] equLeft - The array of contours on the left side. [out] equRight - The array of contours on the right side.
 void MakeHatchingArea ( const PArray< MbCurve > & contour, double witdh, PArray< MbCurve > & borders )

Construction of hatching with a given width inside or near curves.

Parameters:
 [in] contour - Initial curves [in] witdh - The hatching width. [out] borders - The array of hatching lines and hatching boundaries.
 bool Fillet ( MbCurve * curve1, const MbCartPoint & pnt1, bool trim1, MbCurve * curve2, const MbCartPoint & pnt2, bool trim2, double rad, MbeState & state1, MbeState & state2, MbArc *& arc )

Construct fillet with a constant radius between two curves.

Parameters:
 [in] curve1 - The first curve. [in] pnt1 - The point near the first curve. [in] trim1 - The attribute of trimming of the first curve. [in] curve2 - The second curve. [in] pnt2 - The point near the second curve. [in] trim2 - The attribute of trimming of the second curve. [in] rad - The radius of fillet. [out] state1 - The state of the first curve. [out] state2 - The state of the second curve. [out] arc - The arc of fillet.
Returns:
true in case of successful operation.
 bool Chamfer ( MbCurve * curve1, const MbCartPoint & pnt1, bool trim1, MbCurve * curve2, const MbCartPoint & pnt2, bool trim2, double len, double angle, bool type, MbeState & state1, MbeState & state2, MbLineSegment *& lineseg )

Construct a chamfer between two curves.

Parameters:
 [in] curve1 - The first curve. [in] pnt1 - The point near the first curve. [in] trim1 - The attribute of trimming of the first curve. [in] curve2 - The second curve. [in] pnt2 - The point near the second curve. [in] trim2 - The attribute of trimming of the second curve. [in] len - The size of the chamfer on the first curve. [in] angle - The angle of the chamfer or the size of the chamfer on the second curve according to the type of construction. [in] type - The type of chamfer construction: true - size + angle, false - size + size. [out] state1 - The state of the first curve. [out] state2 - The state of the second curve. [out] lineseg - The segment of the chamfer.
Returns:
is true in case of successful operation.
 MbeState FilletPolyContour ( MbCurve * mc, double rad, bool nodeFlag, const MbCartPoint & pnt, MbContour *& contour )

Construct a fillet of polyline or contour.
The curve "mc" being modified should be a polyline or a contour.

Parameters:
 [in] mc - The modified curve. [in] rad - The radius of fillet. [in] nodeFlag - The flag of selection of fillet nodes. true - fillet at all nodes, false - fillet of the nearest node. [in] pnt - The point of choosing of the nearest node. [out] contour - Contour constructed by a polyline.
Returns:
The state of a curve after modification.
 bool ChamferPolyContour ( MbCurve * mc, double l1, double par, bool chamferTypeFlag, bool nodeFlag, const MbCartPoint & pnt )

Construct a chamfer of polyline or contour.
The curve "mc" being modified should be a polyline or a contour.

Parameters:
 [in] mc - The modified curve. [in] l1 - The size of a chamfer. [in] par - The angle of a chamfer or the size of a chamfer on the second curve according to the type of construction. [in] chamferTypeFlag - The type of chamfer construction: true - size + angle, false - size + size. [in] nodeFlag - The flag of selection of fillet nodes. true - fillet at all nodes, false - fillet of the nearest node. [in] pnt - The point of choosing of the nearest node.
 bool Corner ( MbCurve * crv1, MbCurve * crv2, const MbCartPoint & p1, const MbCartPoint & p2 )

Extend two curves to the point of intersection.

Parameters:
 [in,out] crv1 - The first curve. [in,out] crv2 - The second curve. [in] p1 - The point for selection of intersection location. [in] p2 - The point for selection of intersection location.
 void HatchIntersectLine ( double y, MbCurve * curve, SArray< MbCartPoint > & crossPnt )

Find intersection of a curve with horizontal line. For hatching.

Parameters:
 [in] y - The coordinate of a horizontal line. [in] curve - The curve. [out] crossPnt - Intersection points.
 void HatchIntersectCircle ( MbCurve * circle, MbCurve * curve, SArray< MbCartPoint > & crossPnt )

Find intersection with a circle.
For hatching.

Parameters:
 [in] circle - The circle. [in] curve - The curve. [out] crossPnt - Intersection points.
 double CurveRelative ( const MbCurve & curve, const MbCartPoint & p1, const MbCartPoint & p2 )

For the definition of the rotation axis direction.

Parameters:
 [in] curve - The initial curve. [in] p1 - The first point of an axis. [in] p2 - The second point of an axis.
Returns:
0 in a case of failure,
otherwise the vector product of the normalized axis vector ('p1', 'p2') and the vector ('p1', 'w') is returned. ('w' is the coordinates of the curve's center of gravity).
 double ContourRelative ( const MbCurve & curve, const MbCartPoint & p1, const MbCartPoint & p2, double sag )

This is required for the definition of the sweep contour direction. If a curve is not closed then it becomes closed through an axis.

Parameters:
 [in] curve - The initial curve. [in] p1 - The first point of a segment. [in] p2 - The second point of a segment. [in] sag - The deviation angle. Used for calculation of the step by a curve.
Returns:
The area of the shadow with a sign.
 DEPRECATE_DECLARE MbeIntLoopsResult BooleanIntLoops ( const MbCurve & loop1, bool bOrient1, const MbCurve & loop2, bool bOrient2, RPArray< MbCurve > & intLoops )

Calculate two closed curves' regions intersection.

Parameters:
 [in] iCheck - Attribute of check of curves for vertices tangency. [in] loop1 - The first closed curve. [in] bOrient1 - The first closed curve orientation: true - interior is considered to be the curve's region, false - exterior is the curve's region. [in] loop2 - The second closed curve. [in] bOrient2 - The second closed curve orientation: true - interior is considered to be the curve's region, false - exterior is the curve's region. [out] intLoops - Intersection curve array.
Attention:
An obsolete function.
Returns:
Intersection result code.
 bool RemoveContourGaps ( MbContour & contour, double accuracy, bool canInsert, bool canReplace )

Remove contour gaps.

Parameters:
 [in] contour - A contour. [in] accuracy - Upper gap size. [in] canInsert - Allow insert segments. [in] canReplace - Allow replace segments.
Returns:
true, if something have changed.
 MpGraph* EncloseContoursBuilder ( const RPArray< MbCurve > & curveList, const MbCartPoint & p, PArray< MbCurve > & usedCurves, PArray< MbContour > & contourArray, double accuracy, bool strict, VERSION version, IProgressIndicator * progInd = `NULL` )

Create contours around the given point. One outer and several inner loops are constructed with single nesting level. Do not send composite curves (contours and polygons). Lay them on the components.

Parameters:
 [in] curveList - List of curves for construction. [in] p - A point the contours are constructed around. [out] usedCurves - Used curves. [out] contourArray - The result of construction is a set of contours. [in] accuracy - The accuracy of determining the intersection of curves and proximity. [in] strict - If false, the construction is performed roughly. [in] version - The version of construction. The last version Math::DefaultMathVersion(). [in] progInd - Execution progress indicator.
Returns:
Contours construction graph.
Warning:
While using functions EncloseContoursBuilder, OuterContoursBuilder, ContoursReconstructor, a single state of 'strict' flag and version must be used in one treatment process.
 MpGraph* OuterContoursBuilder ( const RPArray< MbCurve > & curveList, PArray< MbContour > & contourArray, double accuracy, bool strict, VERSION version, IProgressIndicator * progInd = `NULL` )

Construct enclosing contours on the basis of the given curves. Outer and inner loops are constructed with an arbitrary level of inclusion. Do not send composite curves (contours and polygons). Lay them on the components.

Parameters:
 [in] curveList - List of curves for construction. [out] contourArray - The result of construction is a set of contours. [in] accuracy - The accuracy of determining the intersection of curves and proximity. [in] strict - If false, the construction is performed roughly. [in] version - The version of construction. The last version Math::DefaultMathVersion(). [in] progInd - Execution progress indicator.
Returns:
Contours construction graph.
Warning:
While using functions EncloseContoursBuilder, OuterContoursBuilder, ContoursReconstructor, a single state of 'strict' flag and version must be used in one treatment process.
 MpGraph* ContoursReconstructor ( const RPArray< MbCurve > & curveList, MpGraph * graph, PArray< MbContour > & contourArray, double accuracy, bool strict, VERSION version, IProgressIndicator * progInd = `NULL` )

Reconstruct contours constructed around the point before. The function reconstructs the graph constructed by EncloseContoursBuilder function.

Parameters:
 [in] curveList - List of curves for construction. [in] graph - A graph to reconstruct. [out] contourArray - The result of construction is a set of contours. [in] accuracy - The accuracy of determining the intersection of curves and proximity. [in] strict - If false, the construction is performed roughly. [in] version - The version of construction. The last version Math::DefaultMathVersion(). [in] progInd - Execution progress indicator.
Returns:
Contours construction graph.
Warning:
While using functions EncloseContoursBuilder, OuterContoursBuilder, ContoursReconstructor, a single state of 'strict' flag and version must be used in one treatment process.
 void NearPointProjections ( const MbContour & contour, const MbCartPoint & pnt, SArray< double > & tProjs, bool isNear, double mEps = `METRIC_REGION` )

Nearest projections of point on the contour.

Parameters:
 [in] contour - A contour. [in] pnt - Projecting point. [out] tProjs - Parameters of nearest projections. [in] isNear - Select only the projections which are located from projecting point within a given tolerance. [in] mEps - A tolerance of nearest points selection.
 MbeNewtonResult NearestPoints ( const MbCurve & curve1, bool ext1, const MbCurve & curve2, bool ext2, double xEpsilon, double yEpsilon, double & t1, double & t2, double & dmin, VERSION version = `Math::DefaultMathVersion()` )

Calculate parameters of the nearest points of two curves and the distance between these points.

Parameters:
 [in] curve1 - Curve 1. [in] ext1 - An attribute of search on the extension of the curve 1. [in] curve2 - Curve 2. [in] ext2 - An attribute of search on the extension of the curve 2. [in] xEpsilon - Tolerance in X direction. [in] yEpsilon - Tolerance in Y direction. [out] t1 - A point parameter of curve 1. [out] t2 - A point parameter of curve 2. [out] dmin - The distance between points of curves. [in] version - Version.
Returns:
Return nr_Success (+1) or nr_Special(0) in a case of successful defining, return nr_Failure(-1) in a case of failure.
 double AreaSign ( const MbCurve & curve, double sag, bool close )

Calculate an area of a closed curve. Orientation of a closed curve is defined by the sign of an area. If the area is positive then the closed curve is directed counterclockwise.
If the curve is not closed, but the flag of closedness is set, then an area will be calculated for the curve which is closed by a section connecting bounds.

Parameters:
 [in] curve - The initial curve. [in] sag - An angular deviation of a tangent curve at the neighbor integration points, is it used for the calculation of the step by a curve. [in] close - A flag of closedness.
Returns:
An area of closed curve with a sign (orientation).
template<class Point >
 bool c3d::EqualPoints ( const Point & p1, const Point & p2, double xEpsilon, double yEpsilon )
Parameters:
 [in] p1 - The first cartesian point. [in] p2 - The second cartesian point. [in] xEpsilon - The metric tolerance of points coincidence along the X axis. [in] yEpsilon - The metric tolerance of points coincidence along the Y axis.
Returns:
True if points coincide,
false otherwise.
template<class Vector >
 bool c3d::EqualVectors ( const Vector & p1, const Vector & p2, double xEpsilon, double yEpsilon )

Check equality of vectors with given tolerance. Vectors are equal if their coordinates differs less than given tolerance.

Parameters:
 [in] p1 - The first vector. [in] p2 - The second vector. [in] xEpsilon - The metric tolerance of points coincidence along the X axis. [in] yEpsilon - The metric tolerance of points coincidence along the Y axis.
Returns:
Returns true if the vectors are equal.
 bool c3d::EqualLengths ( double lx, double ly, double minLen = `METRIC_EPSILON`, double minDev = `LENGTH_EPSILON` ) ` [inline]`
Parameters:
 [in] lx,ly - Compared lengths. [in] minLen - A minimum possible length. [in] minDev - A metric accuracy of lengths equality.
Returns:
True if lengths are equal,
false otherwise.
 bool FilletMultiline ( MbMultiline & multiline, double rad, bool nodeFlag, MbCartPoint & pnt, const StVertexOfMultilineInfo & vertInfo )

Construct a fillet of the base curve of multiline.

Parameters:
 [in] multiline - A multiline to be modified. [in] rad - The radius of fillet. [in] nodeFlag - Flag of selection of vertices to fillet: true - fillet of all vertices of multiline, false - fillet of the vertex nearest to 'pnt' point. [in] pnt - Point for indication the required vertex. [in] vertInfo - Information for new vertices of a multiline.
 bool ChamferMultiline ( MbMultiline & multiline, double len, double par, bool type, bool nodeFlag, MbCartPoint & pnt, const StVertexOfMultilineInfo & vertInfo )

Construct a chamfer of the base curve of multiline.

Parameters:
 [in] multiline - A multiline to be modified. [in] len - Length of chamfer. [in] par - Parameter depending on 'type' type: if type = true, par is a corner, if type = false, par is a size. [in] type - The type of a chamfer specification: true - chamfer specified as size + angle, false - chamfer specified as size + size. [in] nodeFlag - Flag of selection of vertices to process: true - chamfer between each two neighboring segments of multiline, false - chamfer between two neighboring multiline segments joining at the vertex nearest to 'pnt' point. [in] pnt - Point for indication the required pair of segments. [in] vertInfo - Information for new vertices of a multiline.
 void ToTakeIntoCurvesCrvRadii ( MbCurve & curve, double angle, double & minPos, double & maxNeg )

Consider the curve curvature minimum positive and maximum negative radii.
For internal use only.

Parameters:
 [in] curve - A curve of multiline. [in] angle - An angular tolerance. [in,out] minPos - Curve radius if it is less than current value of 'minPos' variable. [in,out] maxNeg - Curve radius if it is greater than current value of 'minPos' variable.
 void GetContoursCrvRadii ( MbContour & contour, double angle, double & minPos, double & maxNeg )

Get the contour curvature minimum positive and maximum negative radii.
For internal use only.

Parameters:
 [in] contour - A contour. [in] angle - An angular tolerance. [out] minPos - Minimal contour segment radius. [out] maxNeg - Maximal contour segment radius.
 bool SmoothJointSuccessiveCurves ( MbCurve & curve1, MbCurve & curve2 )

Smoothly join two consecutive curves.
For internal use only.

Parameters:
 [in] curve1 - The first curve. [in] curve2 - The second curve.
Returns:
True if at least one curve has been changed.
 bool BreakMultiline ( const MbMultiline & multiline, const MbCartPoint & p1, const MbCartPoint & p2, PArray< MbMultiline > & parts )

Split multiline into two pieces.

Parameters:
 [in] multiline - A multiline to be split. [in] p1 - Splitting point or start point of a new multiline if the multiline is closed. [in] p2 - End point of a new multiline if the multiline is closed. [out] parts - The array of obtained pieces (two elements).
 bool BreakMultilineNParts ( const MbMultiline & multiline, size_t partsCount, const MbCartPoint & point, PArray< MbMultiline > & parts )

Split multiline into N equal pieces.

Parameters:
 [in] multiline - A multiline to be split. [in] partsCount - The count of pieces. [in] point - Bounding point for closed multiline. [out] parts - The array of obtained pieces (partsCount elements).
 void GetCorrectRegions ( const RPArray< MbContour > & contours, bool sameContours, RPArray< MbRegion > & regions )

Get a set of correct regions from arbitrary set of regions.
From sent contours there are selected such contours which are suitable for construction of region - closed, without self-intersections and discontinuities.

Parameters:
 [in] contours - A set of contours. [in] sameContours - A flag of using of contours originals when creating regions. [out] regions - The result is a set of points.
 void MakeRegions ( RPArray< MbContour > & contours, bool useSelfIntCntrs, bool sameContours, RPArray< MbRegion > & regions )

Divide arbitrary set of contours into connected groups of contours and construct regions.
For any contour belonging to connected group, this group contain all contours:
1) which coincide with the given contour
2) which intersect the given contour
3) which contain the given contour
4) which are contained in the given contour
Groups are returned in regions form (perhaps, incorrect).

Parameters:
 [in] contours - A set of contours for dividing into groups. [in] useSelfIntCntrs - If true then self-intersected contours form separate groups (incorrect regions), otherwise - such contours are not used at all. [in] sameContours - A flag of using of contours originals when creating regions. [out] regions - The result is a set of points.
 bool CreateBooleanResultRegions ( RPArray< MbContour > & contours1, RPArray< MbContour > & contours2, const MbRegionBooleanParams & operParams, RPArray< MbRegion > & regions, MbResultType * resInfo = `NULL` )

Perform boolean operation with two regions, which are set by the contours array.

Parameters:
 [in] contours1 - First set of contours. [in] contours2 - Second set of contours. [in] operParams - A Boolean operation parameters. [out] regions - The result is a set of points. [out] resInfo - Operation result code.
Returns:
Returns true if the operation succeeded.
 bool CreateBooleanResultRegions ( MbRegion & region1, MbRegion & region2, const MbRegionBooleanParams & operParams, RPArray< MbRegion > & regions, MbResultType * resInfo = `NULL` )

Perform boolean operation with two regions.

Parameters:
 [in] region1 - First region. [in] region2 - Second region. [in] operParams - A Boolean operation parameters. [out] regions - The result is a set of points. [out] resInfo - Operation result code.
Returns:
Returns true if the operation succeeded.
 bool MakeUnionRegions ( RPArray< MbRegion > & regions, bool allowSelfTouch = `true`, bool mergeCurves = `true` )

Perform union of regions.

Parameters:
 [in,out] regions - Initial and resulting regions. [in] allowSelfTouch - Admissibility of self-touches as a result. [in] mergeCurves - Merge similar segments of curves.
Returns:
Returns true if a pair of regions has been united.