Skip to content

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.

cpp
#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

cpp
CurveType myType;

Methods

Factory Methods

CreateLine

Creates a line curve from two points.

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

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

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

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

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

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

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

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

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

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

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

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

cpp
 LCurve() const;
~LCurve

Destructor.

cpp
 ~LCurve() const;
LCurve

Copy constructor.

cpp
 LCurve(const  & LCurve other) const;

other The curve to copy from.

Parameters:

  • other - The curve to copy from.
operator=

Assignment operator.

cpp
& 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.

cpp
CurveType GetType() const;

The curve type enumeration value.

IsValid

Checks if this curve is valid (not undefined).

cpp
bool IsValid() const;

True if the curve is valid, false otherwise.

IsLine
cpp
bool IsLine() const;
IsCircle
cpp
bool IsCircle() const;
IsEllipse
cpp
bool IsEllipse() const;
IsParabola
cpp
bool IsParabola() const;
IsHyperbola
cpp
bool IsHyperbola() const;
IsBSpline
cpp
bool IsBSpline() const;
IsBezier
cpp
bool IsBezier() const;
IsTrimmed
cpp
bool IsTrimmed() const;
IsOffset
cpp
bool IsOffset() const;
FirstParameter

Gets the first parameter of the curve.

cpp
double FirstParameter() const;

First parameter value.

LastParameter

Gets the last parameter of the curve.

cpp
double LastParameter() const;

Last parameter value.

IsClosed

Checks if the curve is closed.

cpp
bool IsClosed() const;

True if closed, false otherwise.

IsPeriodic

Checks if the curve is periodic.

cpp
bool IsPeriodic() const;

True if periodic, false otherwise.

Period

Gets the period of the curve (valid only if periodic).

cpp
double Period() const;

Period value.

Continuity

Gets the continuity level of the curve.

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

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

cpp
CurveParameterData GetParameterData() const;

POD structure containing all parameter information.

D0

Evaluates the curve at parameter u (D0 - position only).

cpp
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).

cpp
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).

cpp
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).

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

cpp
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).

cpp
Point ValueAt(double u) const;

u Parameter value. on the curve. Point

Parameters:

  • u - Parameter value.
TangentAt

Gets the tangent vector at parameter u.

cpp
Vector TangentAt(double u) const;

u Parameter value. Tangent vector (first derivative).

Parameters:

  • u - Parameter value.
Length

Calculates the length of the curve.

cpp
double Length() const;

Total length of the curve.

Length

Calculates the length of the curve between two parameters.

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

cpp
LineData GetLineData() const;

containing position and direction. LineData

GetCircleData

Gets complete circle data as POD structure.

cpp
CircleData GetCircleData() const;

containing center, normal, and radius. CircleData

GetEllipseData

Gets complete ellipse data as POD structure.

cpp
EllipseData GetEllipseData() const;

containing center, major/minor axes and radii. EllipseData

GetParabolaData

Gets complete parabola data as POD structure.

cpp
ParabolaData GetParabolaData() const;

containing focus, axis, and focal length. ParabolaData

GetHyperbolaData

Gets complete hyperbola data as POD structure.

cpp
HyperbolaData GetHyperbolaData() const;

containing center, major/minor axes and radii. HyperbolaData

GetBSplineData

Gets B-Spline curve metadata (degree, counts, flags, bounds).

cpp
BSplineCurveData GetBSplineData() const;

POD structure containing B-Spline parameters.

GetBezierData

Gets Bezier curve metadata (degree, counts, flags, bounds).

cpp
BezierCurveData GetBezierData() const;

POD structure containing Bezier parameters.

GetTrimmedData

Gets trimmed curve data.

cpp
TrimmedCurveData GetTrimmedData() const;

POD structure containing trimming parameters.

GetOffsetData

Gets offset curve data.

cpp
OffsetCurveData GetOffsetData() const;

POD structure containing offset parameters.

GetBasisCurve

Gets the basis curve for trimmed curves.

cpp
LCurve GetBasisCurve() const;

The underlying curve that was trimmed. Returns invalid curve if not trimmed.

GetOffsetBasisCurve

Gets the basis curve for offset curves.

cpp
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).

cpp
bool IsComposite() const;

True if this curve is trimmed, offset, or other composite type.

Transform

Transforms this curve in place.

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

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

cpp
void Reverse() const;
Reversed

Returns a reversed copy of this curve.

cpp
LCurve Reversed() const;

Reversed curve.

Enumerations

CurveType

Enumeration of supported Geom curve types.

cpp
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

cpp
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

cpp
#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

cpp
CurveType myType;

Methods

Factory Methods

CreateLine

Creates a line from two points.

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

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

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

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

cpp
static LCurve2d CreateCircle(const  & CircleData2d data);

data Circle data structure. Circle curve.

Parameters:

  • data - Circle data structure.
CreateCircle

Creates a circle from three points.

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

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

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

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

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

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

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

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

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

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

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

cpp
 LCurve2d() const;
~LCurve2d

Destructor.

cpp
 ~LCurve2d() const;
LCurve2d

Copy constructor.

cpp
 LCurve2d(const  & LCurve2d other) const;

other The curve to copy from.

Parameters:

  • other - The curve to copy from.
operator=

Assignment operator.

cpp
& 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.

cpp
CurveType GetType() const;

The curve type.

IsValid

Check if this curve is valid.

cpp
bool IsValid() const;

True if the curve is defined and valid.

IsLine

Check if this is a line.

cpp
bool IsLine() const;

True if this curve is a line.

IsCircle

Check if this is a circle.

cpp
bool IsCircle() const;

True if this curve is a circle.

IsEllipse

Check if this is an ellipse.

cpp
bool IsEllipse() const;

True if this curve is an ellipse.

IsParabola

Check if this is a parabola.

cpp
bool IsParabola() const;

True if this curve is a parabola.

IsHyperbola

Check if this is a hyperbola.

cpp
bool IsHyperbola() const;

True if this curve is a hyperbola.

IsBSpline

Check if this is a B-Spline curve.

cpp
bool IsBSpline() const;

True if this curve is a B-Spline.

IsBezier

Check if this is a Bezier curve.

cpp
bool IsBezier() const;

True if this curve is a Bezier curve.

IsTrimmed

Check if this is a trimmed curve.

cpp
bool IsTrimmed() const;

True if this curve is trimmed.

IsOffset

Check if this is an offset curve.

cpp
bool IsOffset() const;

True if this curve is an offset curve.

ValueAt

Evaluate point at parameter.

cpp
Point2d ValueAt(double u) const;

u Parameter value. on curve. Point

Parameters:

  • u - Parameter value.
TangentAt

Evaluate first derivative (tangent) at parameter.

cpp
Vector2d TangentAt(double u) const;

u Parameter value. Tangent vector.

Parameters:

  • u - Parameter value.
D1

Evaluate curve and first derivative at parameter.

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

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

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

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

cpp
double Length() const;

Curve length.

Length

Calculate length between two parameters.

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

cpp
double FirstParameter() const;

First parameter value.

LastParameter

Get last parameter of curve.

cpp
double LastParameter() const;

Last parameter value.

IsClosed

Check if curve is closed.

cpp
bool IsClosed() const;

True if closed.

IsPeriodic

Check if curve is periodic.

cpp
bool IsPeriodic() const;

True if periodic.

Period

Get period of curve (if periodic).

cpp
double Period() const;

Period value.

Continuity

Get continuity of curve.

cpp
int Continuity() const;

Continuity order (0=C0, 1=C1, 2=C2, etc.).

IsCN

Check if curve has CN continuity.

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

cpp
CurveParameterData2d GetParameterData() const;

Parameter data structure.

Transformed

Apply a 2D transformation to this curve.

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

cpp
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).

cpp
LineData2d GetLineData() const;

Line data structure.

GetCircleData

Get circle data (if this is a circle).

cpp
CircleData2d GetCircleData() const;

Circle data structure.

GetEllipseData

Get ellipse data (if this is an ellipse).

cpp
EllipseData2d GetEllipseData() const;

Ellipse data structure.

GetParabolaData

Get parabola data (if this is a parabola).

cpp
ParabolaData2d GetParabolaData() const;

Parabola data structure.

GetHyperbolaData

Get hyperbola data (if this is a hyperbola).

cpp
HyperbolaData2d GetHyperbolaData() const;

Hyperbola data structure.

GetBSplineData

Get B-Spline data (if this is a B-Spline curve).

cpp
BSplineCurveData2d GetBSplineData() const;

B-Spline data structure.

GetBezierData

Get Bezier data (if this is a Bezier curve).

cpp
BezierCurveData2d GetBezierData() const;

Bezier data structure.

GetTrimmedData

Get trimmed curve data (if this is a trimmed curve).

cpp
TrimmedCurveData2d GetTrimmedData() const;

Trimmed curve data structure.

GetOffsetData

Get offset curve data (if this is an offset curve).

cpp
OffsetCurveData2d GetOffsetData() const;

Offset curve data structure.

GetBasisCurve

Gets the basis curve for trimmed curves.

cpp
LCurve2d GetBasisCurve() const;

The underlying curve that was trimmed. Returns invalid curve if not trimmed.

GetOffsetBasisCurve

Gets the basis curve for offset curves.

cpp
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).

cpp
bool IsComposite() const;

True if this curve is trimmed, offset, or other composite type.

Enumerations

CurveType

Enumeration of supported 2D curve types.

cpp
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

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

cpp
#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

cpp
SurfaceType myType;

Methods

Factory Methods

CreatePlane

Creates a plane surface from origin and normal.

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

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

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

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

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

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

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

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

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

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

cpp
 LSurface() const;
~LSurface

Destructor.

cpp
 ~LSurface() const;
LSurface

Copy constructor.

cpp
 LSurface(const  & LSurface other) const;

other The surface to copy from.

Parameters:

  • other - The surface to copy from.
operator=

Assignment operator.

cpp
& 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.

cpp
SurfaceType GetType() const;

The surface type enumeration value.

IsValid

Checks if this surface is valid (not undefined).

cpp
bool IsValid() const;

True if the surface is valid, false otherwise.

IsPlane
cpp
bool IsPlane() const;
IsCylinder
cpp
bool IsCylinder() const;
IsSphere
cpp
bool IsSphere() const;
IsCone
cpp
bool IsCone() const;
IsTorus
cpp
bool IsTorus() const;
IsBSpline
cpp
bool IsBSpline() const;
IsBezier
cpp
bool IsBezier() const;
IsTrimmed
cpp
bool IsTrimmed() const;
IsOffset
cpp
bool IsOffset() const;
IsExtrusion
cpp
bool IsExtrusion() const;
IsRevolution
cpp
bool IsRevolution() const;
UFirstParameter

Gets the first U parameter of the surface.

cpp
double UFirstParameter() const;

First U parameter value.

ULastParameter

Gets the last U parameter of the surface.

cpp
double ULastParameter() const;

Last U parameter value.

VFirstParameter

Gets the first V parameter of the surface.

cpp
double VFirstParameter() const;

First V parameter value.

VLastParameter

Gets the last V parameter of the surface.

cpp
double VLastParameter() const;

Last V parameter value.

IsUClosed

Checks if the surface is closed in U direction.

cpp
bool IsUClosed() const;

True if closed in U, false otherwise.

IsVClosed

Checks if the surface is closed in V direction.

cpp
bool IsVClosed() const;

True if closed in V, false otherwise.

IsUPeriodic

Checks if the surface is periodic in U direction.

cpp
bool IsUPeriodic() const;

True if periodic in U, false otherwise.

IsVPeriodic

Checks if the surface is periodic in V direction.

cpp
bool IsVPeriodic() const;

True if periodic in V, false otherwise.

UPeriod

Gets the period in U direction (valid only if U-periodic).

cpp
double UPeriod() const;

U period value.

VPeriod

Gets the period in V direction (valid only if V-periodic).

cpp
double VPeriod() const;

V period value.

UContinuity

Gets the continuity level in U direction.

cpp
int UContinuity() const;

U continuity level (0=C0, 1=C1, 2=C2, etc., -1=CN infinite).

VContinuity

Gets the continuity level in V direction.

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

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

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

cpp
SurfaceParameterData GetParameterData() const;

POD structure containing all parameter information.

D0

Evaluates the surface at parameters (u,v) (D0 - position only).

cpp
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).

cpp
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).

cpp
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).

cpp
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).

cpp
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).

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

cpp
PlaneData GetPlaneData() const;

containing origin point and normal vector. PlaneData

GetCylinderData

Gets complete cylinder data as POD structure.

cpp
CylinderData GetCylinderData() const;

containing origin point, axis direction and radius. CylinderData

GetSphereData

Gets complete sphere data as POD structure.

cpp
SphereData GetSphereData() const;

containing center point and radius. SphereData

GetConeData

Gets complete cone data as POD structure.

cpp
ConeData GetConeData() const;

containing apex point, axis direction and semi-angle. ConeData

GetTorusData

Gets complete torus data as POD structure.

cpp
TorusData GetTorusData() const;

containing center point, axis direction, major and minor radii. TorusData

GetBSplineData

Gets B-Spline surface metadata (degrees, counts, flags, bounds).

cpp
BSplineSurfaceData GetBSplineData() const;

POD structure containing B-Spline parameters.

GetBezierData

Gets Bezier surface metadata (degrees, counts, flags, bounds).

cpp
BezierSurfaceData GetBezierData() const;

POD structure containing Bezier parameters.

GetTrimmedData

Gets complete trimmed surface data as POD structure.

cpp
TrimmedSurfaceData GetTrimmedData() const;

containing trimming parameters and sense flags. TrimmedSurfaceData

GetOffsetData

Gets complete offset surface data as POD structure.

cpp
OffsetSurfaceData GetOffsetData() const;

containing offset distance and direction. OffsetSurfaceData

GetExtrusionData

Gets complete extrusion surface data as POD structure.

cpp
ExtrusionSurfaceData GetExtrusionData() const;

containing extrusion direction vector. ExtrusionSurfaceData

GetRevolutionData

Gets complete revolution surface data as POD structure.

cpp
RevolutionSurfaceData GetRevolutionData() const;

containing revolution axis and location. RevolutionSurfaceData

GetBasisSurface

Gets the basis surface for trimmed surfaces.

cpp
LSurface GetBasisSurface() const;

The underlying surface that was trimmed. Returns invalid surface if not trimmed.

GetOffsetBasisSurface

Gets the basis surface for offset surfaces.

cpp
LSurface GetOffsetBasisSurface() const;

The underlying surface that was offset. Returns invalid surface if not offset.

GetExtrusionBasisCurve

Gets the basis curve for extrusion surfaces.

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

cpp
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).

cpp
bool IsComposite() const;

True if this surface is trimmed, offset, extrusion, revolution, or other composite type.

Transform

Transforms this surface in place.

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

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

cpp
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

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

cpp
#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

cpp
TransformType myType;

Methods

Factory Methods

CreateIdentity

Creates an identity transformation.

cpp
static LTransform CreateIdentity();

Identity transformation.

CreateTranslation

Creates a translation transformation.

cpp
static LTransform CreateTranslation(const  & Vector vec);

vec Translation vector. Translation transformation.

Parameters:

  • vec - Translation vector.
CreateTranslation

Creates a translation transformation from point to point.

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

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

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

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

cpp
static LTransform CreateScale(double scale);

scale Scale factor. Scaling transformation.

Parameters:

  • scale - Scale factor.
CreateMirror

Creates a point mirror transformation.

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

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

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

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

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

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

cpp
 LTransform() const;
~LTransform

Destructor.

cpp
 ~LTransform() const;
LTransform

Copy constructor.

cpp
 LTransform(const  & LTransform other) const;

other The transformation to copy from.

Parameters:

  • other - The transformation to copy from.
operator=

Assignment operator.

cpp
& 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.

cpp
TransformType GetType() const;

The transformation type enumeration value.

IsValid

Checks if this transformation is valid.

cpp
bool IsValid() const;

True if the transformation is valid, false otherwise.

IsTrsf

Checks if this is a standard transformation (gp_Trsf).

cpp
bool IsTrsf() const;

True if this is a standard transformation, false otherwise.

IsGTrsf

Checks if this is a general transformation (gp_GTrsf).

cpp
bool IsGTrsf() const;

True if this is a general transformation, false otherwise.

GetTransformationData

Gets transformation data as POD structure.

cpp
TransformationData GetTransformationData() const;

POD structure containing transformation data.

GetTranslationPart

Gets the translation part of the transformation.

cpp
Vector GetTranslationPart() const;

Translation vector.

IsIdentity

Checks if this is an identity transformation.

cpp
bool IsIdentity() const;

True if identity, false otherwise.

IsNegative

Checks if this transformation has negative determinant.

cpp
bool IsNegative() const;

True if negative, false otherwise.

GetScaleFactor

Gets the scale factor (valid only for uniform scaling transformations).

cpp
double GetScaleFactor() const;

Scale factor.

TransformPoint

Transforms a point using this transformation.

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

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

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

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

cpp
LTransform Inverted() const;

Inverted transformation.

Invert

Inverts this transformation in place.

cpp
void Invert() const;
Powered

Returns this transformation raised to the nth power (valid only for standard transformations).

cpp
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).

cpp
void Power(int n) const;

n The power to raise to.

Parameters:

  • n - The power to raise to.
SetIdentity

Sets this transformation to identity.

cpp
void SetIdentity() const;

Enumerations

TransformType

Enumeration of supported transformation types.

cpp
enum TransformType {
    TRANSFORM_UNDEFINED
    TRANSFORM_TRSF
    TRANSFORM_GTRSF
};

Type Definitions

TypeEnum

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

cpp
#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

cpp
TransformType myType;

Methods

Factory Methods

CreateIdentity

Creates an identity transformation.

cpp
static LTransform2d CreateIdentity();

Identity transformation.

CreateTranslation

Creates a 2D translation transformation.

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

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

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

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

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

cpp
static LTransform2d CreateScale(double scale);

scale Scale factor. Scaling transformation.

Parameters:

  • scale - Scale factor.
CreateMirror

Creates a point mirror transformation.

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

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

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

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

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

cpp
 LTransform2d() const;
~LTransform2d

Destructor.

cpp
 ~LTransform2d() const;
LTransform2d

Copy constructor.

cpp
 LTransform2d(const  & LTransform2d other) const;

other The transform to copy from.

Parameters:

  • other - The transform to copy from.
operator=

Assignment operator.

cpp
& 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.

cpp
TransformType GetType() const;

The transformation type enumeration value.

IsValid

Checks if this transformation is valid (not undefined).

cpp
bool IsValid() const;

True if the transformation is valid, false otherwise.

IsTrsf

Checks if this is a standard transformation (gp_Trsf2d).

cpp
bool IsTrsf() const;

True if this is a standard transformation, false otherwise.

IsGTrsf

Checks if this is a general transformation (gp_GTrsf2d).

cpp
bool IsGTrsf() const;

True if this is a general transformation, false otherwise.

GetTransformationData

Gets transformation data as POD structure.

cpp
TransformationData2d GetTransformationData() const;

POD structure containing transformation data.

GetTranslationPart

Gets the translation part of the transformation.

cpp
Vector2d GetTranslationPart() const;

Translation vector.

IsIdentity

Checks if this is an identity transformation.

cpp
bool IsIdentity() const;

True if identity, false otherwise.

IsNegative

Checks if this transformation has negative determinant.

cpp
bool IsNegative() const;

True if negative, false otherwise.

GetScaleFactor

Gets the scale factor (valid only for uniform scaling transformations).

cpp
double GetScaleFactor() const;

Scale factor.

TransformPoint

Transforms a 2D point.

cpp
Point2d TransformPoint(const  & Point2d point) const;

point to transform. Point Transformed point.

Parameters:

  • point - to transform.
TransformVector

Transforms a 2D vector.

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

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

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

cpp
LTransform2d Inverted() const;

Inverted transformation.

Invert

Inverts this transformation in place.

cpp
void Invert() const;
Powered

Returns this transformation raised to the nth power (valid only for standard transformations).

cpp
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).

cpp
void Power(int n) const;

n The power to raise to.

Parameters:

  • n - The power to raise to.
SetIdentity

Sets this transformation to identity.

cpp
void SetIdentity() const;

Enumerations

TransformType

Enumeration of supported 2D transformation types.

cpp
enum TransformType {
    TRANSFORM2D_UNDEFINED
    TRANSFORM2D_TRSF
    TRANSFORM2D_GTRSF
};

Type Definitions

TypeEnum

cpp
TransformType TypeEnum;

Released under the LGPL-2.1 License