Geometry Module
Core geometric primitives including 3D curves, surfaces, and transformations.
LightOcct::LCurve
A geometric curve class using enum + Handle pattern for type-safe Geom curve storage.
This class provides a unified interface for working with different types of Geom curves (lines, circles, ellipses, parabolas, hyperbolas, BSplines, Bezier, trimmed, offset curves) while hiding OCCT implementation details. The class uses an enum to identify the curve type and stores a Handle(Geom_Curve) internally, providing wrapper methods for all operations to avoid exposing OCCT types in the public interface. Unlike the previous gp-based implementation, this supports the full range of OCCT geometric curves including complex curves like BSplines and provides access to advanced methods like D0, D1, D2, D3 derivatives.
#include <light-occt/geometry/LCurve.hxx>Quick Reference
Fields: myType
Factory Methods: CreateLine(), CreateLine(), CreateCircle(), CreateCircle(), CreateEllipse(), CreateParabola(), CreateHyperbola(), CreateBSpline(), CreateBSplineCurve(), CreateBezier(), CreateTrimmed(), CreateOffset()
Methods: LCurve(), ~LCurve(), LCurve(), operator=(), GetType(), IsValid(), IsLine(), IsCircle(), IsEllipse(), IsParabola(), IsHyperbola(), IsBSpline(), IsBezier(), IsTrimmed(), IsOffset(), FirstParameter(), LastParameter(), IsClosed(), IsPeriodic(), Period(), Continuity(), IsCN(), GetParameterData(), D0(), D1(), D2(), D3(), DN(), ValueAt(), TangentAt(), Length(), Length(), GetLineData(), GetCircleData(), GetEllipseData(), GetParabolaData(), GetHyperbolaData(), GetBSplineData(), GetBezierData(), GetTrimmedData(), GetOffsetData(), GetBasisCurve(), GetOffsetBasisCurve(), IsComposite(), Transform(), Transformed(), Reverse(), Reversed()
Enums: CurveType
Types: TypeEnum
Fields
myType
CurveType myType;Methods
Factory Methods
CreateLine
Creates a line curve from two points.
static LCurve CreateLine(const & Point p1, const & Point p2);p1 First point on the line. p2 Second point on the line. Line curve.
Parameters:
p1- First point on the line.p2- Second point on the line.
CreateLine
Creates a line curve from origin and direction.
static LCurve CreateLine(const & Point origin, const & Vector direction);origin on the line. Point direction Direction vector of the line. Line curve.
Parameters:
origin- on the line.direction- Direction vector of the line.
CreateCircle
Creates a circle curve.
static LCurve CreateCircle(const & Point center, const & Vector normal, double radius);center Center point of the circle. normal Normal vector to the circle plane. radius Radius of the circle. Circle curve.
Parameters:
center- Center point of the circle.normal- Normal vector to the circle plane.radius- Radius of the circle.
CreateCircle
Creates a circle curve from three points.
static LCurve CreateCircle(const & Point p1, const & Point p2, const & Point p3);p1 First point on the circle. p2 Second point on the circle. p3 Third point on the circle. Circle curve.
Parameters:
p1- First point on the circle.p2- Second point on the circle.p3- Third point on the circle.
CreateEllipse
Creates an ellipse curve.
static LCurve CreateEllipse(const & Point center, const & Vector normal, const & Vector majorAxis, double majorRadius, double minorRadius);center Center of the ellipse. normal Normal vector to the ellipse plane. majorAxis Direction of the major axis. majorRadius Length of the major semi-axis. minorRadius Length of the minor semi-axis. Ellipse curve.
Parameters:
center- Center of the ellipse.normal- Normal vector to the ellipse plane.majorAxis- Direction of the major axis.majorRadius- Length of the major semi-axis.minorRadius- Length of the minor semi-axis.
CreateParabola
Creates a parabola curve.
static LCurve CreateParabola(const & Point focus, const & Vector axis, double focalLength);focus Focus point of the parabola. axis Axis direction of the parabola. focalLength Focal length of the parabola. Parabola curve.
Parameters:
focus- Focus point of the parabola.axis- Axis direction of the parabola.focalLength- Focal length of the parabola.
CreateHyperbola
Creates a hyperbola curve.
static LCurve CreateHyperbola(const & Point center, const & Vector axis, const & Vector otherAxis, double majorRadius, double minorRadius);center Center of the hyperbola. axis Major axis direction. otherAxis Direction perpendicular to axis (for reference system). majorRadius Major semi-axis length. minorRadius Minor semi-axis length. Hyperbola curve.
Parameters:
center- Center of the hyperbola.axis- Major axis direction.otherAxis- Direction perpendicular to axis (for reference system).majorRadius- Major semi-axis length.minorRadius- Minor semi-axis length.
CreateBSpline
Creates a B-Spline curve from POD data structure.
static LCurve CreateBSpline(const & BSplineCurveData data);data Complete B-Spline curve data with vectors. B-Spline curve.
Parameters:
data- Complete B-Spline curve data with vectors.
CreateBSplineCurve
Creates a B-Spline curve from control points and degree. Convenience method that automatically generates knot vector and multiplicities.
static LCurve CreateBSplineCurve(const std::vector< > & Point points, int degree);points Control points for the B-Spline curve. degree Degree of the B-Spline curve (1-3). B-Spline curve interpolating through the points.
Parameters:
points- Control points for the B-Spline curve.degree- Degree of the B-Spline curve (1-3).
CreateBezier
Creates a Bezier curve from POD data structure.
static LCurve CreateBezier(const & BezierCurveData data);data Complete Bezier curve data with vectors. Bezier curve.
Parameters:
data- Complete Bezier curve data with vectors.
CreateTrimmed
Creates a trimmed curve from a basis curve.
static LCurve CreateTrimmed(const & LCurve basisCurve, double u1, double u2, bool sense);basisCurve The curve to be trimmed. u1 First parameter for trimming. u2 Second parameter for trimming. sense Sense of parameterization (true = same as basis, false = reversed). Trimmed curve.
Parameters:
basisCurve- The curve to be trimmed.u1- First parameter for trimming.u2- Second parameter for trimming.sense- Sense of parameterization (true = same as basis, false = reversed).
CreateOffset
Creates an offset curve from a basis curve.
static LCurve CreateOffset(const & LCurve basisCurve, double offset, const & Vector direction);basisCurve The curve to be offset. offset Offset distance. direction Direction of the offset. Offset curve.
Parameters:
basisCurve- The curve to be offset.offset- offset Offset distance.direction- Direction of the offset.
Instance Methods
LCurve
Default constructor - creates an undefined curve.
LCurve() const;~LCurve
Destructor.
~LCurve() const;LCurve
Copy constructor.
LCurve(const & LCurve other) const;other The curve to copy from.
Parameters:
other- The curve to copy from.
operator=
Assignment operator.
& LCurve operator=(const & LCurve other) const;other The curve to assign from. Reference to this curve.
Parameters:
other- The curve to assign from.
GetType
Gets the type of this curve.
CurveType GetType() const;The curve type enumeration value.
IsValid
Checks if this curve is valid (not undefined).
bool IsValid() const;True if the curve is valid, false otherwise.
IsLine
bool IsLine() const;IsCircle
bool IsCircle() const;IsEllipse
bool IsEllipse() const;IsParabola
bool IsParabola() const;IsHyperbola
bool IsHyperbola() const;IsBSpline
bool IsBSpline() const;IsBezier
bool IsBezier() const;IsTrimmed
bool IsTrimmed() const;IsOffset
bool IsOffset() const;FirstParameter
Gets the first parameter of the curve.
double FirstParameter() const;First parameter value.
LastParameter
Gets the last parameter of the curve.
double LastParameter() const;Last parameter value.
IsClosed
Checks if the curve is closed.
bool IsClosed() const;True if closed, false otherwise.
IsPeriodic
Checks if the curve is periodic.
bool IsPeriodic() const;True if periodic, false otherwise.
Period
Gets the period of the curve (valid only if periodic).
double Period() const;Period value.
Continuity
Gets the continuity level of the curve.
int Continuity() const;Continuity level (0=C0, 1=C1, 2=C2, etc., -1=CN infinite).
IsCN
Checks if the curve has the specified continuity level.
bool IsCN(int n) const;n Continuity level to check. True if the curve has at least C^n continuity.
Parameters:
n- Continuity level to check.
GetParameterData
Gets comprehensive parameter data for the curve.
CurveParameterData GetParameterData() const;POD structure containing all parameter information.
D0
Evaluates the curve at parameter u (D0 - position only).
Point D0(double u) const;u Parameter value. on the curve. Point
Parameters:
u- Parameter value.
D1
Evaluates the curve and first derivative at parameter u (D1).
CurveDerivativeData D1(double u) const;u Parameter value. Structure containing position and first derivative.
Parameters:
u- Parameter value.
D2
Evaluates the curve and first two derivatives at parameter u (D2).
CurveDerivativeData D2(double u) const;u Parameter value. Structure containing position, first and second derivatives.
Parameters:
u- Parameter value.
D3
Evaluates the curve and first three derivatives at parameter u (D3).
CurveDerivativeData D3(double u) const;u Parameter value. Structure containing position and first three derivatives.
Parameters:
u- Parameter value.
DN
Evaluates the nth derivative at parameter u.
Vector DN(double u, int n) const;u Parameter value. n Order of derivative (must be >= 1). Derivative vector of order n.
Parameters:
u- Parameter value.n- Order of derivative (must be >= 1).
ValueAt
Evaluates the curve at parameter u (alias for D0).
Point ValueAt(double u) const;u Parameter value. on the curve. Point
Parameters:
u- Parameter value.
TangentAt
Gets the tangent vector at parameter u.
Vector TangentAt(double u) const;u Parameter value. Tangent vector (first derivative).
Parameters:
u- Parameter value.
Length
Calculates the length of the curve.
double Length() const;Total length of the curve.
Length
Calculates the length of the curve between two parameters.
double Length(double u1, double u2) const;u1 First parameter. u2 Second parameter. Length between the parameters.
Parameters:
u1- First parameter.u2- Second parameter.
GetLineData
Gets complete line data as POD structure.
LineData GetLineData() const;containing position and direction. LineData
GetCircleData
Gets complete circle data as POD structure.
CircleData GetCircleData() const;containing center, normal, and radius. CircleData
GetEllipseData
Gets complete ellipse data as POD structure.
EllipseData GetEllipseData() const;containing center, major/minor axes and radii. EllipseData
GetParabolaData
Gets complete parabola data as POD structure.
ParabolaData GetParabolaData() const;containing focus, axis, and focal length. ParabolaData
GetHyperbolaData
Gets complete hyperbola data as POD structure.
HyperbolaData GetHyperbolaData() const;containing center, major/minor axes and radii. HyperbolaData
GetBSplineData
Gets B-Spline curve metadata (degree, counts, flags, bounds).
BSplineCurveData GetBSplineData() const;POD structure containing B-Spline parameters.
GetBezierData
Gets Bezier curve metadata (degree, counts, flags, bounds).
BezierCurveData GetBezierData() const;POD structure containing Bezier parameters.
GetTrimmedData
Gets trimmed curve data.
TrimmedCurveData GetTrimmedData() const;POD structure containing trimming parameters.
GetOffsetData
Gets offset curve data.
OffsetCurveData GetOffsetData() const;POD structure containing offset parameters.
GetBasisCurve
Gets the basis curve for trimmed curves.
LCurve GetBasisCurve() const;The underlying curve that was trimmed. Returns invalid curve if not trimmed.
GetOffsetBasisCurve
Gets the basis curve for offset curves.
LCurve GetOffsetBasisCurve() const;The underlying curve that was offset. Returns invalid curve if not offset.
IsComposite
Checks if this curve is a composite type (references another curve).
bool IsComposite() const;True if this curve is trimmed, offset, or other composite type.
Transform
Transforms this curve in place.
void Transform(const & LTransform transform) const;transform The transformation to apply.
Parameters:
transform- The transformation to apply.
Transformed
Returns a transformed copy of this curve.
LCurve Transformed(const & LTransform transform) const;transform The transformation to apply. Transformed curve.
Parameters:
transform- The transformation to apply.
Reverse
Reverses the parameterization of this curve in place.
void Reverse() const;Reversed
Returns a reversed copy of this curve.
LCurve Reversed() const;Reversed curve.
Enumerations
CurveType
Enumeration of supported Geom curve types.
enum CurveType {
CURVE_LINE
CURVE_CIRCLE
CURVE_ELLIPSE
CURVE_PARABOLA
CURVE_HYPERBOLA
CURVE_BSPLINE
CURVE_BEZIER
CURVE_TRIMMED
CURVE_OFFSET
CURVE_UNDEFINED
};Type Definitions
TypeEnum
CurveType TypeEnum;LightOcct::LCurve2d
A 2D geometric curve class using Handle(Geom2d_Curve) architecture.
This class provides comprehensive support for 2D curves using OCCT's Geom2d package. It follows the same enum + Handle pattern as but for 2D geometry. This architecture provides access to advanced curve types like B-Spline and Bezier curves while maintaining the simple interface for basic curves. LCurve
#include <light-occt/geometry/LCurve2d.hxx>Quick Reference
Fields: myType
Factory Methods: CreateLine(), CreateLine(), CreateLine(), CreateCircle(), CreateCircle(), CreateCircle(), CreateEllipse(), CreateEllipse(), CreateParabola(), CreateParabola(), CreateHyperbola(), CreateHyperbola(), CreateBSpline(), CreateBezier(), CreateTrimmed(), CreateOffset()
Methods: LCurve2d(), ~LCurve2d(), LCurve2d(), operator=(), GetType(), IsValid(), IsLine(), IsCircle(), IsEllipse(), IsParabola(), IsHyperbola(), IsBSpline(), IsBezier(), IsTrimmed(), IsOffset(), ValueAt(), TangentAt(), D1(), D2(), D3(), DN(), Length(), Length(), FirstParameter(), LastParameter(), IsClosed(), IsPeriodic(), Period(), Continuity(), IsCN(), GetParameterData(), Transformed(), Transform(), GetLineData(), GetCircleData(), GetEllipseData(), GetParabolaData(), GetHyperbolaData(), GetBSplineData(), GetBezierData(), GetTrimmedData(), GetOffsetData(), GetBasisCurve(), GetOffsetBasisCurve(), IsComposite()
Enums: CurveType
Types: TypeEnum
Fields
myType
CurveType myType;Methods
Factory Methods
CreateLine
Creates a line from two points.
static LCurve2d CreateLine(const & Point2d p1, const & Point2d p2);p1 First point. p2 Second point. Line curve.
Parameters:
p1- First point.p2- Second point.
CreateLine
Creates a line from point and direction.
static LCurve2d CreateLine(const & Point2d point, const & Vector2d direction);point on the line. Point direction Direction vector. Line curve.
Parameters:
point- on the line.direction- Direction vector.
CreateLine
Creates a line from line data.
static LCurve2d CreateLine(const & LinePoints2d data);data Line data structure. Line curve.
Parameters:
data- Line data structure.
CreateCircle
Creates a circle from center and radius.
static LCurve2d CreateCircle(const & Point2d center, double radius);center Center point. radius Radius. Circle curve.
Parameters:
center- Center point.
CreateCircle
Creates a circle from circle data.
static LCurve2d CreateCircle(const & CircleData2d data);data Circle data structure. Circle curve.
Parameters:
data- Circle data structure.
CreateCircle
Creates a circle from three points.
static LCurve2d CreateCircle(const & Point2d p1, const & Point2d p2, const & Point2d p3);p1 First point on the circle. p2 Second point on the circle. p3 Third point on the circle. Circle curve.
Parameters:
p1- First point on the circle.p2- Second point on the circle.p3- Third point on the circle.
CreateEllipse
Creates an ellipse from center, major/minor radii, and major axis direction.
static LCurve2d CreateEllipse(const & Point2d center, const & Vector2d majorAxis, double majorRadius, double minorRadius);center Center point. majorAxis Direction of major axis. majorRadius Major radius. minorRadius Minor radius. Ellipse curve.
Parameters:
center- Center point.majorAxis- Direction of major axis.majorRadius- Major radius.minorRadius- Minor radius.
CreateEllipse
Creates an ellipse from ellipse data.
static LCurve2d CreateEllipse(const & EllipseData2d data);data Ellipse data structure. Ellipse curve.
Parameters:
data- Ellipse data structure.
CreateParabola
Creates a parabola from focus, axis, and focal length.
static LCurve2d CreateParabola(const & Point2d focus, const & Vector2d axis, double focalLength);focus Focus point. axis Axis direction. focalLength Focal length. Parabola curve.
Parameters:
focus- Focus point.axis- Axis direction.focalLength- Focal length.
CreateParabola
Creates a parabola from parabola data.
static LCurve2d CreateParabola(const & ParabolaData2d data);data Parabola data structure. Parabola curve.
Parameters:
data- Parabola data structure.
CreateHyperbola
Creates a hyperbola from center, major axis, and radii.
static LCurve2d CreateHyperbola(const & Point2d center, const & Vector2d majorAxis, double majorRadius, double minorRadius);center Center point. majorAxis Direction of major axis. majorRadius Major radius. minorRadius Minor radius. Hyperbola curve.
Parameters:
center- Center point.majorAxis- Direction of major axis.majorRadius- Major radius.minorRadius- Minor radius.
CreateHyperbola
Creates a hyperbola from hyperbola data.
static LCurve2d CreateHyperbola(const & HyperbolaData2d data);data Hyperbola data structure. Hyperbola curve.
Parameters:
data- Hyperbola data structure.
CreateBSpline
Creates a B-Spline curve from BSpline data.
static LCurve2d CreateBSpline(const & BSplineCurveData2d data);data Complete B-Spline curve data. B-Spline curve.
Parameters:
data- Complete B-Spline curve data.
CreateBezier
Creates a Bezier curve from Bezier data.
static LCurve2d CreateBezier(const & BezierCurveData2d data);data Complete Bezier curve data. Bezier curve.
Parameters:
data- Complete Bezier curve data.
CreateTrimmed
Creates a trimmed curve from a basis curve.
static LCurve2d CreateTrimmed(const & LCurve2d basisCurve, double u1, double u2, bool sense);basisCurve The curve to be trimmed. u1 First parameter for trimming. u2 Second parameter for trimming. sense Sense of parametrization. Trimmed curve.
Parameters:
basisCurve- The curve to be trimmed.u1- First parameter for trimming.u2- Second parameter for trimming.sense- Sense of parametrization.
CreateOffset
Creates an offset curve from a basis curve.
static LCurve2d CreateOffset(const & LCurve2d basisCurve, double offset);basisCurve The curve to be offset. offset Offset distance. Offset curve.
Parameters:
basisCurve- The curve to be offset.offset- offset Offset distance.
Instance Methods
LCurve2d
Default constructor - creates an undefined curve.
LCurve2d() const;~LCurve2d
Destructor.
~LCurve2d() const;LCurve2d
Copy constructor.
LCurve2d(const & LCurve2d other) const;other The curve to copy from.
Parameters:
other- The curve to copy from.
operator=
Assignment operator.
& LCurve2d operator=(const & LCurve2d other) const;other The curve to assign from. Reference to this curve.
Parameters:
other- The curve to assign from.
GetType
Get the type of this curve.
CurveType GetType() const;The curve type.
IsValid
Check if this curve is valid.
bool IsValid() const;True if the curve is defined and valid.
IsLine
Check if this is a line.
bool IsLine() const;True if this curve is a line.
IsCircle
Check if this is a circle.
bool IsCircle() const;True if this curve is a circle.
IsEllipse
Check if this is an ellipse.
bool IsEllipse() const;True if this curve is an ellipse.
IsParabola
Check if this is a parabola.
bool IsParabola() const;True if this curve is a parabola.
IsHyperbola
Check if this is a hyperbola.
bool IsHyperbola() const;True if this curve is a hyperbola.
IsBSpline
Check if this is a B-Spline curve.
bool IsBSpline() const;True if this curve is a B-Spline.
IsBezier
Check if this is a Bezier curve.
bool IsBezier() const;True if this curve is a Bezier curve.
IsTrimmed
Check if this is a trimmed curve.
bool IsTrimmed() const;True if this curve is trimmed.
IsOffset
Check if this is an offset curve.
bool IsOffset() const;True if this curve is an offset curve.
ValueAt
Evaluate point at parameter.
Point2d ValueAt(double u) const;u Parameter value. on curve. Point
Parameters:
u- Parameter value.
TangentAt
Evaluate first derivative (tangent) at parameter.
Vector2d TangentAt(double u) const;u Parameter value. Tangent vector.
Parameters:
u- Parameter value.
D1
Evaluate curve and first derivative at parameter.
void D1(double u, & Point2d point, & Vector2d derivative) const;u Parameter value. point Output point on curve. derivative Output first derivative.
Parameters:
u- Parameter value.point- Output point on curve.derivative- Output first derivative.
D2
Evaluate curve, first and second derivatives at parameter.
void D2(double u, & Point2d point, & Vector2d firstDeriv, & Vector2d secondDeriv) const;u Parameter value. point Output point on curve. firstDeriv Output first derivative. secondDeriv Output second derivative.
Parameters:
u- Parameter value.point- Output point on curve.firstDeriv- Output first derivative.secondDeriv- Output second derivative.
D3
Evaluate curve, first, second and third derivatives at parameter.
void D3(double u, & Point2d point, & Vector2d firstDeriv, & Vector2d secondDeriv, & Vector2d thirdDeriv) const;u Parameter value. point Output point on curve. firstDeriv Output first derivative. secondDeriv Output second derivative. thirdDeriv Output third derivative.
Parameters:
u- Parameter value.point- Output point on curve.firstDeriv- Output first derivative.secondDeriv- Output second derivative.thirdDeriv- Output third derivative.
DN
Evaluate curve and derivatives up to nth order.
CurveDerivativeData2d DN(double u, int n) const;u Parameter value. n Derivative order (0 to n). Curve derivative data with position and derivatives.
Parameters:
u- Parameter value.n- Derivative order (0 to n).
Length
Calculate the length of the curve.
double Length() const;Curve length.
Length
Calculate length between two parameters.
double Length(double u1, double u2) const;u1 First parameter. u2 Second parameter. Length between parameters.
Parameters:
u1- First parameter.u2- Second parameter.
FirstParameter
Get first parameter of curve.
double FirstParameter() const;First parameter value.
LastParameter
Get last parameter of curve.
double LastParameter() const;Last parameter value.
IsClosed
Check if curve is closed.
bool IsClosed() const;True if closed.
IsPeriodic
Check if curve is periodic.
bool IsPeriodic() const;True if periodic.
Period
Get period of curve (if periodic).
double Period() const;Period value.
Continuity
Get continuity of curve.
int Continuity() const;Continuity order (0=C0, 1=C1, 2=C2, etc.).
IsCN
Check if curve has CN continuity.
bool IsCN(int n) const;n Continuity order to check. True if curve has at least CN continuity.
Parameters:
n- Continuity order to check.
GetParameterData
Get complete parameter analysis data.
CurveParameterData2d GetParameterData() const;Parameter data structure.
Transformed
Apply a 2D transformation to this curve.
LCurve2d Transformed(const & LTransform2d transform) const;transform 2D transformation to apply. New transformed curve.
Parameters:
transform- 2D transformation to apply.
Transform
Transform this curve in place.
void Transform(const & LTransform2d transform) const;transform 2D transformation to apply.
Parameters:
transform- 2D transformation to apply.
GetLineData
Get line data (if this is a line).
LineData2d GetLineData() const;Line data structure.
GetCircleData
Get circle data (if this is a circle).
CircleData2d GetCircleData() const;Circle data structure.
GetEllipseData
Get ellipse data (if this is an ellipse).
EllipseData2d GetEllipseData() const;Ellipse data structure.
GetParabolaData
Get parabola data (if this is a parabola).
ParabolaData2d GetParabolaData() const;Parabola data structure.
GetHyperbolaData
Get hyperbola data (if this is a hyperbola).
HyperbolaData2d GetHyperbolaData() const;Hyperbola data structure.
GetBSplineData
Get B-Spline data (if this is a B-Spline curve).
BSplineCurveData2d GetBSplineData() const;B-Spline data structure.
GetBezierData
Get Bezier data (if this is a Bezier curve).
BezierCurveData2d GetBezierData() const;Bezier data structure.
GetTrimmedData
Get trimmed curve data (if this is a trimmed curve).
TrimmedCurveData2d GetTrimmedData() const;Trimmed curve data structure.
GetOffsetData
Get offset curve data (if this is an offset curve).
OffsetCurveData2d GetOffsetData() const;Offset curve data structure.
GetBasisCurve
Gets the basis curve for trimmed curves.
LCurve2d GetBasisCurve() const;The underlying curve that was trimmed. Returns invalid curve if not trimmed.
GetOffsetBasisCurve
Gets the basis curve for offset curves.
LCurve2d GetOffsetBasisCurve() const;The underlying curve that was offset. Returns invalid curve if not offset.
IsComposite
Checks if this curve is a composite type (references another curve).
bool IsComposite() const;True if this curve is trimmed, offset, or other composite type.
Enumerations
CurveType
Enumeration of supported 2D curve types.
enum CurveType {
CURVE2D_LINE
CURVE2D_CIRCLE
CURVE2D_ELLIPSE
CURVE2D_PARABOLA
CURVE2D_HYPERBOLA
CURVE2D_BSPLINE
CURVE2D_BEZIER
CURVE2D_TRIMMED
CURVE2D_OFFSET
CURVE2D_UNDEFINED
};Type Definitions
TypeEnum
CurveType TypeEnum;LightOcct::LSurface
A geometric surface class using enum + Handle pattern for type-safe Geom surface storage.
This class provides a unified interface for working with different types of Geom surfaces (planes, cylinders, spheres, cones, torus, BSplines, Bezier, trimmed, offset, extrusion, revolution) while hiding OCCT implementation details. The class uses an enum to identify the surface type and stores a Handle(Geom_Surface) internally, providing wrapper methods for all operations to avoid exposing OCCT types in the public interface. Unlike the previous gp-based implementation, this supports the full range of OCCT geometric surfaces including complex surfaces like BSplines and provides access to advanced methods like D0, D1, D2 derivatives.
#include <light-occt/geometry/LSurface.hxx>Quick Reference
Fields: myType
Factory Methods: CreatePlane(), CreatePlane(), CreateCylinder(), CreateSphere(), CreateCone(), CreateTorus(), CreateBSpline(), CreateTrimmed(), CreateOffset(), CreateRevolution()
Methods: LSurface(), ~LSurface(), LSurface(), operator=(), GetType(), IsValid(), IsPlane(), IsCylinder(), IsSphere(), IsCone(), IsTorus(), IsBSpline(), IsBezier(), IsTrimmed(), IsOffset(), IsExtrusion(), IsRevolution(), UFirstParameter(), ULastParameter(), VFirstParameter(), VLastParameter(), IsUClosed(), IsVClosed(), IsUPeriodic(), IsVPeriodic(), UPeriod(), VPeriod(), UContinuity(), VContinuity(), IsUCN(), IsVCN(), GetParameterData(), D0(), D1(), D2(), DN(), ValueAt(), NormalAt(), GetPlaneData(), GetCylinderData(), GetSphereData(), GetConeData(), GetTorusData(), GetBSplineData(), GetBezierData(), GetTrimmedData(), GetOffsetData(), GetExtrusionData(), GetRevolutionData(), GetBasisSurface(), GetOffsetBasisSurface(), GetExtrusionBasisCurve(), GetRevolutionBasisCurve(), IsComposite(), Transform(), Transformed()
Enums: SurfaceType
Types: TypeEnum
Fields
myType
SurfaceType myType;Methods
Factory Methods
CreatePlane
Creates a plane surface from origin and normal.
static LSurface CreatePlane(const & Point origin, const & Vector normal);origin on the plane. Point normal Normal vector to the plane. Plane surface with specified origin and normal.
Parameters:
origin- on the plane.normal- Normal vector to the plane.
CreatePlane
Creates a plane surface passing through three points.
static LSurface CreatePlane(const & Point p1, const & Point p2, const & Point p3);p1 First point on the plane. p2 Second point on the plane. p3 Third point on the plane. Plane surface passing through the three points.
Parameters:
p1- First point on the plane.p2- Second point on the plane.p3- Third point on the plane.
CreateCylinder
Creates a cylindrical surface.
static LSurface CreateCylinder(const & Point origin, const & Vector axis, double radius);origin on the cylinder axis. Point axis Direction of the cylinder axis. radius Radius of the cylinder. Cylindrical surface with specified parameters.
Parameters:
origin- on the cylinder axis.axis- Point axis Direction of the cylinder axis.radius- Radius of the cylinder.
CreateSphere
Creates a spherical surface.
static LSurface CreateSphere(const & Point center, double radius);center Center point of the sphere. radius Radius of the sphere. Spherical surface with specified parameters.
Parameters:
center- Center point of the sphere.radius- Radius of the sphere.
CreateCone
Creates a conical surface.
static LSurface CreateCone(const & Point apex, const & Vector axis, double semiAngle);apex Apex point of the cone. axis Axis direction of the cone. semiAngle Half-angle of the cone in radians. Conical surface with specified parameters.
Parameters:
apex- Apex point of the cone.axis- Axis direction of the cone.semiAngle- Half-angle of the cone in radians.
CreateTorus
Creates a torus surface.
static LSurface CreateTorus(const & Point center, const & Vector axis, double majorRadius, double minorRadius);center Center point of the torus. axis Axis direction of the torus. majorRadius Major radius of the torus. minorRadius Minor radius of the torus. Torus surface with specified parameters.
Parameters:
center- Center point of the torus.axis- Axis direction of the torus.majorRadius- Major radius of the torus.minorRadius- Minor radius of the torus.
CreateBSpline
Creates a B-Spline surface from POD data structure.
static LSurface CreateBSpline(const & BSplineSurfaceData data);data Complete B-Spline surface data with vectors. B-Spline surface.
Parameters:
data- Complete B-Spline surface data with vectors.
CreateTrimmed
Creates a trimmed surface from a basis surface.
static LSurface CreateTrimmed(const & LSurface basisSurface, double u1, double u2, double v1, double v2, bool usense, bool vsense);basisSurface The surface to be trimmed. u1 First U parameter for trimming. u2 Second U parameter for trimming. v1 First V parameter for trimming. v2 Second V parameter for trimming. usense U sense of parameterization (true = same as basis, false = reversed). vsense V sense of parameterization (true = same as basis, false = reversed). Trimmed surface.
Parameters:
basisSurface- The surface to be trimmed.u1- First U parameter for trimming.u2- Second U parameter for trimming.v1- First V parameter for trimming.v2- Second V parameter for trimming.usense- U sense of parameterization (true = same as basis, false = reversed).vsense- V sense of parameterization (true = same as basis, false = reversed).
CreateOffset
Creates an offset surface from a basis surface.
static LSurface CreateOffset(const & LSurface basisSurface, double offset);basisSurface The surface to be offset. offset Offset distance. Offset surface.
Parameters:
basisSurface- The surface to be offset.offset- offset Offset distance.
CreateRevolution
Creates a surface of revolution by revolving a curve around an axis.
static LSurface CreateRevolution(const & LCurve basisCurve, const & Axis1Placement axis, double angle);basisCurve The curve to be revolved around the axis. axis Revolution axis defined by location and direction. angle Revolution angle in radians (default: 2*PI for full revolution). Surface of revolution.
Parameters:
basisCurve- The curve to be revolved around the axis.axis- axis Revolution axis defined by location and direction.angle- Revolution angle in radians (default: 2*PI for full revolution).
Instance Methods
LSurface
Default constructor - creates an undefined surface.
LSurface() const;~LSurface
Destructor.
~LSurface() const;LSurface
Copy constructor.
LSurface(const & LSurface other) const;other The surface to copy from.
Parameters:
other- The surface to copy from.
operator=
Assignment operator.
& LSurface operator=(const & LSurface other) const;other The surface to assign from. Reference to this surface.
Parameters:
other- The surface to assign from.
GetType
Gets the type of this surface.
SurfaceType GetType() const;The surface type enumeration value.
IsValid
Checks if this surface is valid (not undefined).
bool IsValid() const;True if the surface is valid, false otherwise.
IsPlane
bool IsPlane() const;IsCylinder
bool IsCylinder() const;IsSphere
bool IsSphere() const;IsCone
bool IsCone() const;IsTorus
bool IsTorus() const;IsBSpline
bool IsBSpline() const;IsBezier
bool IsBezier() const;IsTrimmed
bool IsTrimmed() const;IsOffset
bool IsOffset() const;IsExtrusion
bool IsExtrusion() const;IsRevolution
bool IsRevolution() const;UFirstParameter
Gets the first U parameter of the surface.
double UFirstParameter() const;First U parameter value.
ULastParameter
Gets the last U parameter of the surface.
double ULastParameter() const;Last U parameter value.
VFirstParameter
Gets the first V parameter of the surface.
double VFirstParameter() const;First V parameter value.
VLastParameter
Gets the last V parameter of the surface.
double VLastParameter() const;Last V parameter value.
IsUClosed
Checks if the surface is closed in U direction.
bool IsUClosed() const;True if closed in U, false otherwise.
IsVClosed
Checks if the surface is closed in V direction.
bool IsVClosed() const;True if closed in V, false otherwise.
IsUPeriodic
Checks if the surface is periodic in U direction.
bool IsUPeriodic() const;True if periodic in U, false otherwise.
IsVPeriodic
Checks if the surface is periodic in V direction.
bool IsVPeriodic() const;True if periodic in V, false otherwise.
UPeriod
Gets the period in U direction (valid only if U-periodic).
double UPeriod() const;U period value.
VPeriod
Gets the period in V direction (valid only if V-periodic).
double VPeriod() const;V period value.
UContinuity
Gets the continuity level in U direction.
int UContinuity() const;U continuity level (0=C0, 1=C1, 2=C2, etc., -1=CN infinite).
VContinuity
Gets the continuity level in V direction.
int VContinuity() const;V continuity level (0=C0, 1=C1, 2=C2, etc., -1=CN infinite).
IsUCN
Checks if the surface has the specified continuity level in U.
bool IsUCN(int n) const;n Continuity level to check. True if the surface has at least C^n continuity in U.
Parameters:
n- Continuity level to check.
IsVCN
Checks if the surface has the specified continuity level in V.
bool IsVCN(int n) const;n Continuity level to check. True if the surface has at least C^n continuity in V.
Parameters:
n- Continuity level to check.
GetParameterData
Gets comprehensive parameter data for the surface.
SurfaceParameterData GetParameterData() const;POD structure containing all parameter information.
D0
Evaluates the surface at parameters (u,v) (D0 - position only).
Point D0(double u, double v) const;u U parameter value. v V parameter value. on the surface. Point
Parameters:
u- U parameter value.
D1
Evaluates the surface and first derivatives at parameters (u,v) (D1).
SurfaceDerivativeData D1(double u, double v) const;u U parameter value. v V parameter value. Structure containing position and first derivatives.
Parameters:
u- U parameter value.
D2
Evaluates the surface and first two derivatives at parameters (u,v) (D2).
SurfaceDerivativeData D2(double u, double v) const;u U parameter value. v V parameter value. Structure containing position, first and second derivatives.
Parameters:
u- U parameter value.
DN
Evaluates the nth derivative in U and mth derivative in V at parameters (u,v).
Vector DN(double u, double v, int nu, int nv) const;u U parameter value. v V parameter value. nu Order of derivative in U (must be >= 0). nv Order of derivative in V (must be >= 0). Derivative vector of order (nu, nv).
Parameters:
u- U parameter value.nu- Order of derivative in U (must be >= 0).nv- Order of derivative in V (must be >= 0).
ValueAt
Evaluates the surface at parameters (u,v) (alias for D0).
Point ValueAt(double u, double v) const;u U parameter value. v V parameter value. on the surface. Point
Parameters:
u- U parameter value.
NormalAt
Gets the normal vector at parameters (u,v).
Vector NormalAt(double u, double v) const;u U parameter value. v V parameter value. Normal vector at the specified parameters.
Parameters:
u- U parameter value.
GetPlaneData
Gets complete plane data as POD structure.
PlaneData GetPlaneData() const;containing origin point and normal vector. PlaneData
GetCylinderData
Gets complete cylinder data as POD structure.
CylinderData GetCylinderData() const;containing origin point, axis direction and radius. CylinderData
GetSphereData
Gets complete sphere data as POD structure.
SphereData GetSphereData() const;containing center point and radius. SphereData
GetConeData
Gets complete cone data as POD structure.
ConeData GetConeData() const;containing apex point, axis direction and semi-angle. ConeData
GetTorusData
Gets complete torus data as POD structure.
TorusData GetTorusData() const;containing center point, axis direction, major and minor radii. TorusData
GetBSplineData
Gets B-Spline surface metadata (degrees, counts, flags, bounds).
BSplineSurfaceData GetBSplineData() const;POD structure containing B-Spline parameters.
GetBezierData
Gets Bezier surface metadata (degrees, counts, flags, bounds).
BezierSurfaceData GetBezierData() const;POD structure containing Bezier parameters.
GetTrimmedData
Gets complete trimmed surface data as POD structure.
TrimmedSurfaceData GetTrimmedData() const;containing trimming parameters and sense flags. TrimmedSurfaceData
GetOffsetData
Gets complete offset surface data as POD structure.
OffsetSurfaceData GetOffsetData() const;containing offset distance and direction. OffsetSurfaceData
GetExtrusionData
Gets complete extrusion surface data as POD structure.
ExtrusionSurfaceData GetExtrusionData() const;containing extrusion direction vector. ExtrusionSurfaceData
GetRevolutionData
Gets complete revolution surface data as POD structure.
RevolutionSurfaceData GetRevolutionData() const;containing revolution axis and location. RevolutionSurfaceData
GetBasisSurface
Gets the basis surface for trimmed surfaces.
LSurface GetBasisSurface() const;The underlying surface that was trimmed. Returns invalid surface if not trimmed.
GetOffsetBasisSurface
Gets the basis surface for offset surfaces.
LSurface GetOffsetBasisSurface() const;The underlying surface that was offset. Returns invalid surface if not offset.
GetExtrusionBasisCurve
Gets the basis curve for extrusion surfaces.
LCurve GetExtrusionBasisCurve() const;The curve that was extruded to create this surface. Returns invalid curve if not extrusion.
GetRevolutionBasisCurve
Gets the basis curve for revolution surfaces.
LCurve GetRevolutionBasisCurve() const;The curve that was revolved to create this surface. Returns invalid curve if not revolution.
IsComposite
Checks if this surface is a composite type (references another surface or curve).
bool IsComposite() const;True if this surface is trimmed, offset, extrusion, revolution, or other composite type.
Transform
Transforms this surface in place.
void Transform(const & LTransform transform) const;transform The transformation to apply.
Parameters:
transform- The transformation to apply.
Transformed
Returns a transformed copy of this surface.
LSurface Transformed(const & LTransform transform) const;transform The transformation to apply. Transformed surface.
Parameters:
transform- The transformation to apply.
Enumerations
SurfaceType
Enumeration of supported Geom surface types.
enum SurfaceType {
SURFACE_PLANE
SURFACE_CYLINDER
SURFACE_SPHERE
SURFACE_CONE
SURFACE_TORUS
SURFACE_BSPLINE
SURFACE_BEZIER
SURFACE_TRIMMED
SURFACE_OFFSET
SURFACE_EXTRUSION
SURFACE_REVOLUTION
SURFACE_UNDEFINED
};Type Definitions
TypeEnum
SurfaceType TypeEnum;LightOcct::LTransform
3D Transformation class using enum + union pattern for type-safe storage.
This class provides a unified interface for working with different types of 3D transformations (standard and general transformations) while hiding OCCT implementation details. The class uses an enum + union pattern to store transformation data efficiently and provides wrapper methods for all operations to avoid exposing OCCT types in the public interface.
#include <light-occt/geometry/LTransform.hxx>Quick Reference
Fields: myType
Factory Methods: CreateIdentity(), CreateTranslation(), CreateTranslation(), CreateRotation(), CreateRotation(), CreateScale(), CreateScale(), CreateMirror(), CreateMirror(), CreateMirrorPlane(), CreateGTranslation(), CreateGScale(), CreateGScale()
Methods: LTransform(), ~LTransform(), LTransform(), operator=(), GetType(), IsValid(), IsTrsf(), IsGTrsf(), GetTransformationData(), GetTranslationPart(), IsIdentity(), IsNegative(), GetScaleFactor(), TransformPoint(), TransformVector(), Multiplied(), Multiply(), Inverted(), Invert(), Powered(), Power(), SetIdentity()
Enums: TransformType
Types: TypeEnum
Fields
myType
TransformType myType;Methods
Factory Methods
CreateIdentity
Creates an identity transformation.
static LTransform CreateIdentity();Identity transformation.
CreateTranslation
Creates a translation transformation.
static LTransform CreateTranslation(const & Vector vec);vec Translation vector. Translation transformation.
Parameters:
vec- Translation vector.
CreateTranslation
Creates a translation transformation from point to point.
static LTransform CreateTranslation(const & Point from, const & Point to);from Starting point. to Ending point. Translation transformation.
Parameters:
from- Starting point.to- Ending point.
CreateRotation
Creates a rotation transformation around a point and axis.
static LTransform CreateRotation(const & Point point, const & Vector axis, double angle);point on the rotation axis. Point axis Rotation axis direction. angle Rotation angle in radians. Rotation transformation.
Parameters:
point- on the rotation axis.axis- Point axis Rotation axis direction.angle- Rotation angle in radians.
CreateRotation
Creates a rotation transformation around an axis through origin.
static LTransform CreateRotation(const & Vector axis, double angle);axis Rotation axis direction. angle Rotation angle in radians. Rotation transformation.
Parameters:
axis- Rotation axis direction.angle- Rotation angle in radians.
CreateScale
Creates a uniform scaling transformation around a point.
static LTransform CreateScale(const & Point point, double scale);point Center point for scaling. scale Scale factor. Scaling transformation.
Parameters:
point- Center point for scaling.scale- Scale factor.
CreateScale
Creates a uniform scaling transformation around origin.
static LTransform CreateScale(double scale);scale Scale factor. Scaling transformation.
Parameters:
scale- Scale factor.
CreateMirror
Creates a point mirror transformation.
static LTransform CreateMirror(const & Point point);point to mirror through. Point mirror transformation. Point
Parameters:
point- to mirror through.
CreateMirror
Creates an axis mirror transformation.
static LTransform CreateMirror(const & Point point, const & Vector axis);point on the mirror axis. Point axis Mirror axis direction. Axis mirror transformation.
Parameters:
point- on the mirror axis.axis- Point axis Mirror axis direction.
CreateMirrorPlane
Creates a plane mirror transformation.
static LTransform CreateMirrorPlane(const & Point point, const & Vector normal);point on the mirror plane. Point normal Normal vector to the mirror plane. Plane mirror transformation.
Parameters:
point- on the mirror plane.normal- Normal vector to the mirror plane.
CreateGTranslation
Creates a general translation transformation.
static LTransform CreateGTranslation(const & Vector vec);vec Translation vector. General translation transformation.
Parameters:
vec- Translation vector.
CreateGScale
Creates a non-uniform scaling transformation around a point.
static LTransform CreateGScale(const & Point point, double scaleX, double scaleY, double scaleZ);point Center point for scaling. scaleX Scale factor along X axis. scaleY Scale factor along Y axis. scaleZ Scale factor along Z axis. Non-uniform scaling transformation.
Parameters:
point- Center point for scaling.scaleX- Scale factor along X axis.scaleY- Scale factor along Y axis.scaleZ- Scale factor along Z axis.
CreateGScale
Creates a non-uniform scaling transformation around origin.
static LTransform CreateGScale(double scaleX, double scaleY, double scaleZ);scaleX Scale factor along X axis. scaleY Scale factor along Y axis. scaleZ Scale factor along Z axis. Non-uniform scaling transformation.
Parameters:
scaleX- Scale factor along X axis.scaleY- Scale factor along Y axis.scaleZ- Scale factor along Z axis.
Instance Methods
LTransform
Default constructor - creates an undefined transformation.
LTransform() const;~LTransform
Destructor.
~LTransform() const;LTransform
Copy constructor.
LTransform(const & LTransform other) const;other The transformation to copy from.
Parameters:
other- The transformation to copy from.
operator=
Assignment operator.
& LTransform operator=(const & LTransform other) const;other The transformation to assign from. Reference to this transformation.
Parameters:
other- The transformation to assign from.
GetType
Gets the type of this transformation.
TransformType GetType() const;The transformation type enumeration value.
IsValid
Checks if this transformation is valid.
bool IsValid() const;True if the transformation is valid, false otherwise.
IsTrsf
Checks if this is a standard transformation (gp_Trsf).
bool IsTrsf() const;True if this is a standard transformation, false otherwise.
IsGTrsf
Checks if this is a general transformation (gp_GTrsf).
bool IsGTrsf() const;True if this is a general transformation, false otherwise.
GetTransformationData
Gets transformation data as POD structure.
TransformationData GetTransformationData() const;POD structure containing transformation data.
GetTranslationPart
Gets the translation part of the transformation.
Vector GetTranslationPart() const;Translation vector.
IsIdentity
Checks if this is an identity transformation.
bool IsIdentity() const;True if identity, false otherwise.
IsNegative
Checks if this transformation has negative determinant.
bool IsNegative() const;True if negative, false otherwise.
GetScaleFactor
Gets the scale factor (valid only for uniform scaling transformations).
double GetScaleFactor() const;Scale factor.
TransformPoint
Transforms a point using this transformation.
Point TransformPoint(const & Point point) const;point The point to transform. Transformed point.
Parameters:
point- The point to transform.
TransformVector
Transforms a vector using this transformation.
Vector TransformVector(const & Vector vector) const;vector The vector to transform. Transformed vector.
Parameters:
vector- The vector to transform.
Multiplied
Returns the result of multiplying this transformation with another.
LTransform Multiplied(const & LTransform other) const;other The transformation to multiply with. Result of the multiplication.
Parameters:
other- The transformation to multiply with.
Multiply
Multiplies this transformation with another in place.
void Multiply(const & LTransform other) const;other The transformation to multiply with.
Parameters:
other- The transformation to multiply with.
Inverted
Returns the inverse of this transformation.
LTransform Inverted() const;Inverted transformation.
Invert
Inverts this transformation in place.
void Invert() const;Powered
Returns this transformation raised to the nth power (valid only for standard transformations).
LTransform Powered(int n) const;n The power to raise to. Transformation raised to the nth power.
Parameters:
n- The power to raise to.
Power
Raises this transformation to the nth power in place (valid only for standard transformations).
void Power(int n) const;n The power to raise to.
Parameters:
n- The power to raise to.
SetIdentity
Sets this transformation to identity.
void SetIdentity() const;Enumerations
TransformType
Enumeration of supported transformation types.
enum TransformType {
TRANSFORM_UNDEFINED
TRANSFORM_TRSF
TRANSFORM_GTRSF
};Type Definitions
TypeEnum
TransformType TypeEnum;LightOcct::LTransform2d
2D Transformation class using enum + union pattern for type-safe storage.
This class provides a unified interface for working with different types of 2D transformations (standard and general transformations) while hiding OCCT implementation details. The class uses an enum + union pattern to store transformation data efficiently and provides wrapper methods for all operations to avoid exposing OCCT types in the public interface.
#include <light-occt/geometry/LTransform2d.hxx>Quick Reference
Fields: myType
Factory Methods: CreateIdentity(), CreateTranslation(), CreateTranslation(), CreateRotation(), CreateRotation(), CreateScale(), CreateScale(), CreateMirror(), CreateMirror(), CreateGTranslation(), CreateGScale(), CreateGScale()
Methods: LTransform2d(), ~LTransform2d(), LTransform2d(), operator=(), GetType(), IsValid(), IsTrsf(), IsGTrsf(), GetTransformationData(), GetTranslationPart(), IsIdentity(), IsNegative(), GetScaleFactor(), TransformPoint(), TransformVector(), Multiplied(), Multiply(), Inverted(), Invert(), Powered(), Power(), SetIdentity()
Enums: TransformType
Types: TypeEnum
Fields
myType
TransformType myType;Methods
Factory Methods
CreateIdentity
Creates an identity transformation.
static LTransform2d CreateIdentity();Identity transformation.
CreateTranslation
Creates a 2D translation transformation.
static LTransform2d CreateTranslation(const & Vector2d vec);vec Translation vector. Translation transformation.
Parameters:
vec- Translation vector.
CreateTranslation
Creates a 2D translation transformation from point to point.
static LTransform2d CreateTranslation(const & Point2d from, const & Point2d to);from Starting point. to Ending point. Translation transformation.
Parameters:
from- Starting point.to- Ending point.
CreateRotation
Creates a 2D rotation transformation around a point.
static LTransform2d CreateRotation(const & Point2d point, double angle);point Center point for rotation. angle Rotation angle in radians. Rotation transformation.
Parameters:
point- Center point for rotation.angle- Rotation angle in radians.
CreateRotation
Creates a 2D rotation transformation around origin.
static LTransform2d CreateRotation(double angle);angle Rotation angle in radians. Rotation transformation.
Parameters:
angle- Rotation angle in radians.
CreateScale
Creates a uniform 2D scaling transformation around a point.
static LTransform2d CreateScale(const & Point2d point, double scale);point Center point for scaling. scale Scale factor. Scaling transformation.
Parameters:
point- Center point for scaling.scale- Scale factor.
CreateScale
Creates a uniform 2D scaling transformation around origin.
static LTransform2d CreateScale(double scale);scale Scale factor. Scaling transformation.
Parameters:
scale- Scale factor.
CreateMirror
Creates a point mirror transformation.
static LTransform2d CreateMirror(const & Point2d point);point to mirror through. Point mirror transformation. Point
Parameters:
point- to mirror through.
CreateMirror
Creates a line mirror transformation.
static LTransform2d CreateMirror(const & Point2d point, const & Vector2d direction);point on the mirror line. Point direction Direction of the mirror line. Line mirror transformation.
Parameters:
point- on the mirror line.direction- Direction of the mirror line.
CreateGTranslation
Creates a general 2D translation transformation.
static LTransform2d CreateGTranslation(const & Vector2d vec);vec Translation vector. General translation transformation.
Parameters:
vec- Translation vector.
CreateGScale
Creates a non-uniform 2D scaling transformation around a point.
static LTransform2d CreateGScale(const & Point2d point, double scaleX, double scaleY);point Center point for scaling. scaleX Scale factor along X axis. scaleY Scale factor along Y axis. Non-uniform scaling transformation.
Parameters:
point- Center point for scaling.scaleX- Scale factor along X axis.scaleY- Scale factor along Y axis.
CreateGScale
Creates a non-uniform 2D scaling transformation around origin.
static LTransform2d CreateGScale(double scaleX, double scaleY);scaleX Scale factor along X axis. scaleY Scale factor along Y axis. Non-uniform scaling transformation.
Parameters:
scaleX- Scale factor along X axis.scaleY- Scale factor along Y axis.
Instance Methods
LTransform2d
Default constructor - creates an undefined transformation.
LTransform2d() const;~LTransform2d
Destructor.
~LTransform2d() const;LTransform2d
Copy constructor.
LTransform2d(const & LTransform2d other) const;other The transform to copy from.
Parameters:
other- The transform to copy from.
operator=
Assignment operator.
& LTransform2d operator=(const & LTransform2d other) const;other The transform to assign from. Reference to this transform.
Parameters:
other- The transform to assign from.
GetType
Gets the type of this transformation.
TransformType GetType() const;The transformation type enumeration value.
IsValid
Checks if this transformation is valid (not undefined).
bool IsValid() const;True if the transformation is valid, false otherwise.
IsTrsf
Checks if this is a standard transformation (gp_Trsf2d).
bool IsTrsf() const;True if this is a standard transformation, false otherwise.
IsGTrsf
Checks if this is a general transformation (gp_GTrsf2d).
bool IsGTrsf() const;True if this is a general transformation, false otherwise.
GetTransformationData
Gets transformation data as POD structure.
TransformationData2d GetTransformationData() const;POD structure containing transformation data.
GetTranslationPart
Gets the translation part of the transformation.
Vector2d GetTranslationPart() const;Translation vector.
IsIdentity
Checks if this is an identity transformation.
bool IsIdentity() const;True if identity, false otherwise.
IsNegative
Checks if this transformation has negative determinant.
bool IsNegative() const;True if negative, false otherwise.
GetScaleFactor
Gets the scale factor (valid only for uniform scaling transformations).
double GetScaleFactor() const;Scale factor.
TransformPoint
Transforms a 2D point.
Point2d TransformPoint(const & Point2d point) const;point to transform. Point Transformed point.
Parameters:
point- to transform.
TransformVector
Transforms a 2D vector.
Vector2d TransformVector(const & Vector2d vector) const;vector to transform. Vector Transformed vector.
Parameters:
vector- to transform.
Multiplied
Returns the result of multiplying this transformation with another.
LTransform2d Multiplied(const & LTransform2d other) const;other The transformation to multiply with. Result of the multiplication.
Parameters:
other- The transformation to multiply with.
Multiply
Multiplies this transformation with another in place.
void Multiply(const & LTransform2d other) const;other The transformation to multiply with.
Parameters:
other- The transformation to multiply with.
Inverted
Returns the inverse of this transformation.
LTransform2d Inverted() const;Inverted transformation.
Invert
Inverts this transformation in place.
void Invert() const;Powered
Returns this transformation raised to the nth power (valid only for standard transformations).
LTransform2d Powered(int n) const;n The power to raise to. Transformation raised to the nth power.
Parameters:
n- The power to raise to.
Power
Raises this transformation to the nth power in place (valid only for standard transformations).
void Power(int n) const;n The power to raise to.
Parameters:
n- The power to raise to.
SetIdentity
Sets this transformation to identity.
void SetIdentity() const;Enumerations
TransformType
Enumeration of supported 2D transformation types.
enum TransformType {
TRANSFORM2D_UNDEFINED
TRANSFORM2D_TRSF
TRANSFORM2D_GTRSF
};Type Definitions
TypeEnum
TransformType TypeEnum;