Geometry Utilities
제공 서비스;
- Creation of shapes by interpolation and approximation
- Direct construction of shapes
- Conversion of curves and surfaces to BSpline curves and surfaces
- Computation of the coordinates of points on 2D and 3D curves
- Calculation of extrema between shapes.
Interpolations and Approximations
points -> curves and surfaces.
- interpolation : curve or surface passes through all the points;
- approximation : close to these points as possible.
- the interpolation of a set of 2D points using a 2D BSpline or Bezier curve;
- the approximation of a set of 2D points using a 2D BSpline or Bezier curve;
- the interpolation of a set of 3D points using a 3D BSpline or Bezier curve, or a BSpline surface;
- the approximation of a set of 3D points using a 3D BSpline or Bezier curve, or a BSpline surface.
approximations 2가지 방법;
- High-level functions ; simple method with minimal programming,
- Low-level functions ; more control over the approximations.
Analysis of a set of points
GProp package - class PEquation
collection or cloud of points -> coincident, collinear or coplanar 인지 확인.
맞으면, mean point, the mean line or the mean plane 계산.
아니면, minimal box 계산.
Basic Interpolation and Approximation
Packages Geom2dAPI and GeomAPI
최소 프로그래밍으로 approximation, interpolation 제공
2D Interpolation
Geom2dAPI package - class Interpolate
table of points 로 constrained 2D BSpline curve 작성.
각 점에 대해 parameter values, vectors of the tangents 얻을 수 있음.
3D Interpolation
GeomAPI package - class Interpolate
table of points 로 constrained 3D BSpline curve 작성.
각 점에 대해 parameter values, vectors of the tangents 얻을 수 있음.
GeomAPI_Interpolate Interp(Points);
Handle(Geom_BSplineCurve) C = Interp.Curve();
2D Approximation
Geom2dAPI package - class PointsToBSpline
set of points를 approximate 하여 2DBSpline curve 작성.
최소, 최대 degree of the curve 정의해야 함.
tolerance value는 점들이 너무 가까운지의 기준.
결과는 default C2 continuous.
3D Approximation
GeomAPI package - class PointsToBSpline
set of points를 approximate 하여 3DBSpline curve 작성.
최소, 최대 degree of the curve 정의해야 함.
tolerance value는 점들이 너무 가까운지의 기준.
결과는 default C2 continuous.
GeomAPI_PointsToBSpline Approx(Points,DegMin,DegMax,Continuity, Tol);
Handle(Geom_BSplineCurve) K = Approx.Curve();
Surface Approximation
GeomAPI package - class PointsToBSplineSurface
set of points를 approximate 하여 BSpline surface 작성.
Advanced Approximation
Packages AppDef, AppParCurves는 저수준 함수 제공.
- Define compulsory tangents for an approximation. These tangents have origins and extremities.
- Approximate a set of curves in parallel to respect identical parameterization.
- Smooth approximations. This is to produce a faired curve.
- The minimal box which includes a set of points
- The mean plane, line or point of a set of coplanar, collinear or coincident points.
Approximation by multiple point constraints
AppDef package : parallel approximation of groups of points into Bezier or B-Spline curves using multiple point constraints.
- Definition of an array of point constraints:
The class MultiLine allows defining a given number of multi-point constraints in order to build the multi-line, multiple lines passing through ordered multiple point constraints.
- Pi, Qi, Ri ... Si can be 2D or 3D points.
- Defined as a group: Pn, Qn, Rn, ... Sn form a MultipointConstraint. They possess the same passage, tangency and curvature constraints.
- P1, P2, ... Pn, or the Q, R, ... or S series represent the lines to be approximated.
- Definition of a set of point constraints:
The class MultiPointConstraint allows defining a multiple point constraint and computing the approximation of sets of points to several curves. - Computation of an approximation of a Bezier curve from a set of points:
The class Compute allows making an approximation of a set of points to a Bezier curve. - Computation of an approximation of a BSpline curve from a set of points:
The class BSplineCompute allows making an approximation of a set of points to a BSpline curve.
Definition of Variational Criteria: - The class TheVariational allows fairing the approximation curve to a given number of points using a least squares method in conjunction with a variational criterion, usually the weights at each constraint point.
Approximation by parametric or geometric constraints
AppParCurves package - 저수준 도구 ; parallel approximation of groups of points into Bezier or B-spline curve with parametric or geometric constraints, such as a requirement for the curve to pass through given points, or to have a given tangency or curvature at a particular point.
- the least squares method
- a search for the best approximation within a given tolerance value.
저수준 서비스;
- Association of an index to an object:
The class ConstraintCouple allows you associating an index to an object to compute faired curves using AppDef_TheVariational. - Definition of a set of approximations of Bezier curves:
The class MultiCurve allows defining the approximation of a multi-line made up of multiple Bezier curves. - Definition of a set of approximations of BSpline curves:
The class MultiBSpCurve allows defining the approximation of a multi-line made up of multiple BSpline curves. - Definition of points making up a set of point constraints
The class MultiPoint allows defining groups of 2D or 3D points making up a multi-line.
Example: How to approximate a curve with respect to tangency
approximate a curve with respect to tangency:
- Create an object of type AppDef_MultiPointConstraints from the set of points to approximate and use the method SetTang to set the tangency vectors.
- Create an object of type AppDef_MultiLine from the AppDef_MultiPointConstraint.
- Use AppDef_BSplineCompute, which instantiates Approx_BSplineComputeLine to perform the approximation.
Direct Construction
gce, GC, GCE2d packages
lines, circles and curves 등 기본 geometric entity들을 작성하는 단순화된 알고리즘 제공.
gp, Geom, Geom2d packages가 제공하는 참조 정의를 보완.
gp package 예; point, radius -> circle
gce_MakeCirc 클래스; 결과는 gp_Circ. 성공여부는 status.
gp_Pnt P1 (0.,0.,0.);
gp_Pnt P2 (0.,10.,0.);
gp_Pnt P3 (10.,0.,0.);
gce_MakeCirc MC (P1,P2,P3);
if (MC.IsDone())
{
const gp_Circ& C = MC.Value();
}
Root class;
status를 리턴하는 모든 class의 루트.
enum gce_ErrorType.
geometric transformations를 생성하는 class들은 해당되지 않음.
Simple geometric entities
gp package의 entity들을 생성하는 데에 gce package의 다음 알고리즘들이 제공됨;
- 2D line parallel to another at a distance,
- 2D line parallel to another passing through a point,
- 2D circle passing through two points,
- 2D circle parallel to another at a distance,
- 2D circle parallel to another passing through a point,
- 2D circle passing through three points,
- 2D circle from a center and a radius,
- 2D hyperbola from five points,
- 2D hyperbola from a center and two apexes,
- 2D ellipse from five points,
- 2D ellipse from a center and two apexes,
- 2D parabola from three points,
- 2D parabola from a center and an apex,
- line parallel to another passing through a point,
- line passing through two points,
- circle coaxial to another passing through a point,
- circle coaxial to another at a given distance,
- circle passing through three points,
- circle with its center, radius, and normal to the plane,
- circle with its axis (center + normal),
- hyperbola with its center and two apexes,
- ellipse with its center and two apexes,
- plane passing through three points,
- plane from its normal,
- plane parallel to another plane at a given distance,
- plane parallel to another passing through a point,
- plane from an array of points,
- cylinder from a given axis and a given radius,
- cylinder from a circular base,
- cylinder from three points,
- cylinder parallel to another cylinder at a given distance,
- cylinder parallel to another cylinder passing through a point,
- cone from four points,
- cone from a given axis and two passing points,
- cone from two points (an axis) and two radii,
- cone parallel to another at a given distance,
- cone parallel to another passing through a point,
- all transformations (rotations, translations, mirrors,scaling transformations, etc.).
gce package의 MakeCirc, MakeCirc2d, MakeMirror, MakeMirror2d ...
gp_Pnt2d Point1,Point2;
...
// Initialization of Point1 and Point2
gce_MakeLin2d L = gce_MakeLin2d(Point1,Point2);
if (L.Status() == gce_Done())
{
gp_Lin2d l = L.Value();
}
Point1, Point2 가 tolerance보다 가까우면 Status()는 gce_ConfusedPoint를 리턴.
Geometric entities manipulated by handle
- arc of a circle trimmed by two points,
- arc of a circle trimmed by two parameters,
- arc of a circle trimmed by one point and one parameter,
- arc of an ellipse from an ellipse trimmed by two points,
- arc of an ellipse from an ellipse trimmed by two parameters,
- arc of an ellipse from an ellipse trimmed by one point and one parameter,
- arc of a parabola from a parabola trimmed by two points,
- arc of a parabola from a parabola trimmed by two parameters,
- arc of a parabola from a parabola trimmed by one point and one parameter,
- arc of a hyperbola from a hyperbola trimmed by two points,
- arc of a hyperbola from a hyperbola trimmed by two parameters,
- arc of a hyperbola from a hyperbola trimmed by one point and one parameter,
- segment of a line from two points,
- segment of a line from two parameters,
- segment of a line from one point and one parameter,
- trimmed cylinder from a circular base and a height,
- trimmed cylinder from three points,
- trimmed cylinder from an axis, a radius, and a height,
- trimmed cone from four points,
- trimmed cone from two points (an axis) and a radius,
- trimmed cone from two coaxial circles.
Geom2d package의 MakeCircle, MakeEllipse, MakeMirror...
Geom package의 MakeCircle, MakeEllipse, MakeMirror...
다음 클래스들은 Geom의 TrimmedCurve type 객체를 리턴.
- MakeArcOfCircle
- MakeArcOfEllipse
- MakeArcOfHyperbola
- MakeArcOfParabola
- MakeSegment
Conversion to and from BSplines
two distinct purposes:
- homogeneous formulation which can be used to describe any curve or surface. This is useful for writing algorithms for a single data structure model. The BSpline formulation can be used to represent most basic geometric objects provided by the components which describe geometric data structures ("Fundamental Geometry Types", "2D Geometry Types" and "3D Geometry Types" components).
- divide a BSpline curve or surface into a series of curves or surfaces, thereby providing a higher degree of continuity. This is useful for writing algorithms which require a specific degree of continuity in the objects to which they are applied. Discontinuities are situated on the boundaries of objects only.
component 는 3개 packages로 구성;
- a bounded curve based on an elementary 2D curve (line, circle or conic) from the gp package,
- a bounded surface based on an elementary surface (cylinder, cone, sphere or torus) from the gp package,
- a series of adjacent 2D or 3D Bezier curves defined by their poles.
요소 데이터 : degrees, periodic characteristics, poles and weights, knots and multiplicities
class : Geom2d_BSplineCurve, Geom_BSplineCurve or Geom_BSplineSurface.
Geom2dConvert package;
- a global function which is used to construct a BSpline curve from a bounded curve based on a 2D curve from the Geom2d package,
- a splitting algorithm which computes the points at which a 2D BSpline curve should be cut in order to obtain arcs with the same degree of continuity,
- global functions used to construct the BSpline curves created by this splitting algorithm, or by other types of segmentation of the BSpline curve,
- an algorithm which converts a 2D BSpline curve into a series of adjacent Bezier curves,
- an algorithm which converts an arbitrary 2D curve into a series of adjacent 2D circular arcs and 2D linear segments.
GeomConvert package;
- a global function used to construct a BSpline curve from a bounded curve based on a curve from the Geom package,
- a splitting algorithm, which computes the points at which a BSpline curve should be cut in order to obtain arcs with the same degree of continuity,
- global functions to construct BSpline curves created by this splitting algorithm, or by other types of BSpline curve segmentation,
- an algorithm, which converts a BSpline curve into a series of adjacent Bezier curves,
- a global function to construct a BSpline surface from a bounded surface based on a surface from the Geom package,
- a splitting algorithm, which determines the curves along which a BSpline surface should be cut in order to obtain patches with the same degree of continuity,
- global functions to construct BSpline surfaces created by this splitting algorithm, or by other types of BSpline surface segmentation,
- an algorithm, which converts a BSpline surface into a series of adjacent Bezier surfaces,
- an algorithm, which converts a grid of adjacent Bezier surfaces into a BSpline surface.
- algorithms that converts NURBS, Bezier and other general parametrized curves and surface into anaytical curves and surfaces.
Points on Curves
The Points on Curves component comprises high level functions providing an API for complex algorithms that compute points on a 2D or 3D curve.
The following characteristic points exist on parameterized curves in 3d space:
- points equally spaced on a curve,
- points distributed along a curve with equal chords,
- a point at a given distance from another point on a curve.
GCPnts package - 다음 point들을 계산;
- AbscissaPoint calculates a point on a curve at a given distance from another point on the curve.
- UniformAbscissa calculates a set of points at a given abscissa on a curve.
- UniformDeflection calculates a set of points at maximum constant deflection between the curve and the polygon that results from the computed points.
Example: Visualizing a curve.
Let us take an adapted curve C, i.e. an object which is an interface between the services provided by either a 2D curve from the package Geom2d (in case of an Adaptor_Curve2d curve) or a 3D curve from the package Geom (in case of an Adaptor_Curve curve), and the services required on the curve by the computation algorithm. The adapted curve is created in the following way:
2D case:
Handle(Geom2d_Curve) mycurve = ... ;
Geom2dAdaptor_Curve C (mycurve);
3D case:
Handle(Geom_Curve) mycurve = ... ;
GeomAdaptor_Curve C (mycurve);
GCPnts_UniformDeflection myAlgo ();
Standard_Real Deflection = ... ;
myAlgo.Initialize (C, Deflection);
if (myAlgo.IsDone())
{
Standard_Integer nbr = myAlgo.NbPoints();
Standard_Real param;
for (Standard_Integer i = 1; i <= nbr; i++)
{
param = myAlgo.Parameter (i);
...
}
}
Extrema
GeomAPI and Geom2dAPI packages.
2d and 3d에서 points, curves, surfaces 간 최소 거리 계산하는 class들.
extrema of distance;
- point and a curve,
- point and a surface,
- two curves,
- a curve and a surface,
- two surfaces.
Extrema between Point and Curve / Surface
GeomAPI_ProjectPointOnCurve 클래스
GeomAPI_ProjectPointOnSurface 클래스
"Projection" criteria for optimization.
Extrema between Curves
Geom2dAPI_ExtremaCurveCurve 클래스 (2d curve 간)
GeomAPI_ExtremaCurveCurve 클래스 (3d curve 간).
Euclidean 거리.
Extrema between Curve and Surface
GeomAPI_ExtremaCurveSurface 클래스 - one extrema between a 3D curve and a surface.
"Projection" criteria for optimization.
Extrema between Surfaces
GeomAPI_ExtremaSurfaceSurface 클래스 - one minimal and one maximal distance between two surfaces.
Euclidean 거리 for minimum
"Projection" criteria for maximum.