Construction of Curve and Surface
Abstract Curve and Surface
Curve
Line
AMCAX::MakeLine2 is used to create a two-dimensional line, while AMCAX::MakeLine3 is used to create a three-dimensional line. It is important to note that the lines created here are infinite in length, so to output files, you need to use AMCAX::MakeEdge2d and AMCAX::MakeEdge, along with setting start and end parameters.
Class of making a 2D edge.
Definition MakeEdge2d.hpp:22
Class of making an edge.
Definition MakeEdge.hpp:24
Class of making 2D lines.
Definition MakeLine2.hpp:13
Class of making 3D lines.
Definition MakeLine3.hpp:13
Base class of shape, containing an underlying shape with a location and an orientation.
Definition TopoShape.hpp:15
LineS< 2 > Line2
2D line
Definition LineT.hpp:454
LineS< 3 > Line3
3D line
Definition LineT.hpp:457
DirectionT< double, 2 > Direction2
2D direction
Definition DirectionT.hpp:584
DirectionT< double, 3 > Direction3
3D direction
Definition DirectionT.hpp:587
PointT< double, 3 > Point3
3D point
Definition PointT.hpp:459
PointT< double, 2 > Point2
2D point
Definition PointT.hpp:456
Circle
AMCAX::MakeCircle2 is used to create a two-dimensional circle, while AMCAX::MakeCircle3 is used to create a three-dimensional circle. To output files, you need to use AMCAX::MakeEdge2d and AMCAX::MakeEdge (setting start and end parameters is optional).
Class of making 2D circles.
Definition MakeCircle2.hpp:13
Class of making 3D circles.
Definition MakeCircle3.hpp:15
CircleS< 3 > Circle3
3D circle
Definition CircleT.hpp:178
FrameT< double, 2 > Frame2
2D frame
Definition FrameT.hpp:882
CircleS< 2 > Circle2
2D circle
Definition CircleT.hpp:175
FrameT< double, 3 > Frame3
3D frame
Definition FrameT.hpp:885
Ellipse
AMCAX::MakeEllipse2 is used to create a two-dimensional ellipse, while AMCAX::MakeEllipse3 is used to create a three-dimensional ellipse. To output files, you need to use AMCAX::MakeEdge2d and AMCAX::MakeEdge (setting start and end parameters is optional).
Class of making 2D ellipses.
Definition MakeEllipse2.hpp:13
Class of making 3D ellipses.
Definition MakeEllipse3.hpp:13
EllipseS< 2 > Ellipse2
2D ellipse
Definition EllipseT.hpp:251
EllipseS< 3 > Ellipse3
3D ellipse
Definition EllipseT.hpp:254
Hyperbola
AMCAX::MakeHyperbola2 is used to create a two-dimensional hyperbola, while AMCAX::MakeHyperbola3 is used to create a three-dimensional hyperbola. Note that hyperbolas are infinite, so to output files, you need to use AMCAX::MakeEdge2d and AMCAX::MakeEdge, along with setting start and end parameters.
Class of making 2D hyperbolas.
Definition MakeHyperbola2.hpp:13
Class of making 3D hyperbolas.
Definition MakeHyperbola3.hpp:13
HyperbolaS< 2 > Hyperbola2
2D hyperbola
Definition HyperbolaT.hpp:298
HyperbolaS< 3 > Hyperbola3
3D hyperbola
Definition HyperbolaT.hpp:301
Parabola
AMCAX::MakeParabola2 is used to create a two-dimensional parabola, while AMCAX::MakeParabola3 is used to create a three-dimensional parabola. Note that parabolas are infinite, so to output files, you need to use AMCAX::MakeEdge2d and AMCAX::MakeEdge, along with setting start and end parameters.
Class of making 2D parabolas.
Definition MakeParabola2.hpp:13
Class of making 3D parabolas.
Definition MakeParabola3.hpp:13
ParabolaS< 2 > Parabola2
2D parabola
Definition ParabolaT.hpp:195
ParabolaS< 3 > Parabola3
3D parabola
Definition ParabolaT.hpp:198
Surface
Plane
AMCAX::MakePlane3 is used to create a three-dimensional plane. Note that planes are infinite, so to output files, you need to use AMCAX::MakeFace and set the start and end parameters in the u and v directions.
Class of making a face.
Definition MakeFace.hpp:22
Class of making planes.
Definition MakePlane3.hpp:13
Class of Plane.
Definition Plane.hpp:13
Cone Surface
AMCAX::MakeCone3 is used to create a cone surface. Note that cone surfaces are infinite, so to output files, you need to use AMCAX::MakeFace and set the start and end parameters in the u and v directions.
Class of cone.
Definition Cone.hpp:12
Class of making cones.
Definition MakeCone3.hpp:14
Cylinder Surface
AMCAX::MakeCylinder3 is used to create a cylinder surface. Note that cylinder surfaces are infinite, so to output files, you need to use AMCAX::MakeFace and set the start and end parameters in the u and v directions.
Class of cylinder.
Definition Cylinder.hpp:12
Class of making cylinders.
Definition MakeCylinder3.hpp:14
Complete Geometric Curves and Surfaces
Curves
Line
AMCAX::MakeGeom2Line is used to create a 2D geometric line, and AMCAX::MakeGeom3Line is used to create a 3D geometric line.
std::shared_ptr< AMCAX::Geom2Line > geomline2d = geom2line.Value();
std::shared_ptr< AMCAX::Geom3Line > geomline3d = geom3line.Value();
Class of making 2D geometric lines.
Definition MakeGeom2Line.hpp:13
Class of making 3D geometric lines.
Definition MakeGeom3Line.hpp:15
Circle
AMCAX::MakeGeom2Circle is used to create a 2D geometric circle, and AMCAX::MakeGeom3Circle is used to create a 3D geometric circle.
std::shared_ptr< AMCAX::Geom2Circle > geomcircle2d = geom2circle.Value();
std::shared_ptr< AMCAX::Geom3Circle > geomcircle3d = geom3circle.Value();
Class of making 2D geometric circles.
Definition MakeGeom2Circle.hpp:13
Class of making 3D geometric circles.
Definition MakeGeom3Circle.hpp:13
Ellipse
AMCAX::MakeGeom2Ellipse is used to create a 2D geometric ellipse, and AMCAX::MakeGeom3Ellipse is used to create a 3D geometric ellipse.
std::shared_ptr< AMCAX::Geom2Ellipse >geomellipse2d = geom2ellipse.Value();
std::shared_ptr< AMCAX::Geom3Ellipse >geomellipse3d = geom3ellipse.Value();
Class of making 2D geometric ellipses.
Definition MakeGeom2Ellipse.hpp:13
Class of making 3D geometric ellipses.
Definition MakeGeom3Ellipse.hpp:13
Hyperbola
AMCAX::MakeGeom2Hyperbola is used to create a 2D geometric hyperbola, and AMCAX::MakeGeom3Hyperbola is used to create a 3D geometric hyperbola.
std::shared_ptr< AMCAX::Geom2Hyperbola > geomhyperbola2d = geom2hyperbola.Value();
std::shared_ptr< AMCAX::Geom3Hyperbola > geomhyperbola3d = geom3hyperbola.Value();
Class of making 2D geometric hyperbolas.
Definition MakeGeom2Hyperbola.hpp:13
Class of making 3D geometric hyperbolas.
Definition MakeGeom3Hyperbola.hpp:13
Parabola
AMCAX::MakeGeom2Parabola is used to create a 2D geometric parabola, and AMCAX::MakeGeom3Parabola is used to create a 3D geometric parabola.
std::shared_ptr< AMCAX::Geom2Parabola > geomparabola2d = geom2parabola.Value();
std::shared_ptr< AMCAX::Geom3Parabola > geomparabola3d = geom3parabola.Value();
Class of making 2D geometric parabolas.
Definition MakeGeom2Parabola.hpp:13
Class of making 3D geometric parabolas.
Definition MakeGeom3Parabola.hpp:13
Surfaces
Plane
AMCAX::MakeGeom3Plane is used to create a geometric plane.
std::shared_ptr< AMCAX::Geom3Plane > geomplane = geom3plane.Value();
Class of making geometric planes.
Definition MakeGeom3Plane.hpp:13
static constexpr double Confusion() noexcept
Get the confusion tolerance.
Definition Precision.hpp:122
Conical Surface
AMCAX::MakeGeom3ConicalSurface is used to create a geometric conical surface.
std::shared_ptr< AMCAX::Geom3ConicalSurface > geomconicalsurface = geom3conicalsurface.Value();
Class of making geometric conical surfaces.
Definition MakeGeom3ConicalSurface.hpp:13
Cylindrical Surface
AMCAX::MakeGeom3CylindricalSurface is used to create a geometric cylindrical surface.
std::shared_ptr< AMCAX::Geom3CylindricalSurface > geomcylindricalsurface = geom3cylindersurface.Value();
Class of making geometric cylindrical surfaces.
Definition MakeGeom3CylindricalSurface.hpp:14
Parameter Domain Trimmed Curves and Surfaces
Curves
Line Segment
AMCAX::MakeSegment2d is used to create a 2D line segment, and AMCAX::MakeSegment is used to create a 3D line segment.
std::shared_ptr< AMCAX::Geom2TrimmedCurve > segment2d = makesegment2d.Value();
std::shared_ptr< AMCAX::Geom3TrimmedCurve > segment3d = makesegment.Value();
Class of making 2D line segments.
Definition MakeSegment2d.hpp:17
Class of making 3D line segments.
Definition MakeSegment.hpp:17
Circular Arc
AMCAX::MakeArcOfCircle2d is used to create a 2D circular arc, and AMCAX::MakeArcOfCircle is used to create a 3D circular arc.
std::shared_ptr< AMCAX::Geom2TrimmedCurve >arcofcircle2d = makearcofcircle2d.Value();
std::shared_ptr< AMCAX::Geom3TrimmedCurve >arcofcircle3d = makearcofcircle.Value();
Class of making arcs of 2D circle.
Definition MakeArcOfCircle2d.hpp:17
Class of making arcs of 3D circle.
Definition MakeArcOfCircle.hpp:17
Elliptical Arc
AMCAX::MakeArcOfEllipse2d is used to create a 2D elliptical arc, and AMCAX::MakeArcOfEllipse is used to create a 3D elliptical arc.
std::shared_ptr< AMCAX::Geom2TrimmedCurve > arcofellipse2d = makearcofellipse2d.Value();
std::shared_ptr< AMCAX::Geom3TrimmedCurve > arcofellipse3d = makearcofellipse.Value();
Class of making arcs of 2D ellipse.
Definition MakeArcOfEllipse2d.hpp:17
Class of making arcs of 3D ellipse.
Definition MakeArcOfEllipse.hpp:17
Hyperbolic Arc
AMCAX::MakeArcOfHyperbola2d is used to create a 2D hyperbolic arc, and AMCAX::MakeArcOfHyperbola is used to create a 3D hyperbolic arc.
std::shared_ptr< AMCAX::Geom2TrimmedCurve > arcofhyperbola2d = makearcofhyperbola2d.Value();
std::shared_ptr< AMCAX::Geom3TrimmedCurve > arcofhyperbola3d = makearcofhyperbola.Value();
Class of making arcs of 2D hyperbola.
Definition MakeArcOfHyperbola2d.hpp:17
Class of making arcs of 3D hyperbola.
Definition MakeArcOfHyperbola.hpp:17
Parabolic Arc
AMCAX::MakeArcOfParabola2d is used to create a 2D parabolic arc, and AMCAX::MakeArcOfParabola is used to create a 3D parabolic arc.
std::shared_ptr< AMCAX::Geom2TrimmedCurve > arcofparabola2d = makearcofparabola2d.Value();
std::shared_ptr< AMCAX::Geom3TrimmedCurve > arcofparabola3d = makearcofparabola.Value();
Class of making arcs of 2D parabola.
Definition MakeArcOfParabola2d.hpp:17
Class of making arcs of 3D parabola.
Definition MakeArcOfParabola.hpp:17
Surfaces
Trimmed Conical Surface
AMCAX::MakeTrimmedCone is used to create a trimmed conical surface.
std::shared_ptr< AMCAX::Geom3TrimmedSurface > trimmedcone = maketrimmedcone.Value();
Class of making trimmed cones.
Definition MakeTrimmedCone.hpp:17
Trimmed Cylindrical Surface
AMCAX::MakeTrimmedCylinder is used to create a trimmed cylindrical surface.
std::shared_ptr< AMCAX::Geom3TrimmedSurface > trimmedcylinder = maketrimmedcylinder.Value();
Class of making trimmed cylinders.
Definition MakeTrimmedCylinder.hpp:17
Evaluation of Curves and Surfaces
The evaluation of curves and surfaces can be achieved using Value() or D0().
std::shared_ptr< AMCAX::Geom3TrimmedSurface > trimmedcylinder = maketrimmedcylinder.Value();
double u = 2., v = 0.9;
trimmedcylinder->
D0(u, v, P);
std::cout << "P:" << P << std::endl;
std::cout << trimmedcylinder->
Value(u, v) << std::endl;
virtual AMCAX_API Point3 Value(double u, double v) const
Compute the point at given parameters.
AMCAX_API void D0(double u, double v, Point3 &p) const override
Compute the point at given parameters.
AMCAX_API double LastVParameter() const override
Get the last v parameter.
AMCAX_API double FirstVParameter() const override
Get the first v parameter.
AMCAX_API double FirstUParameter() const override
Get the first u parameter.
AMCAX_API double LastUParameter() const override
Get the last u parameter.
Parametric Curve and Surface Creation through Interpolation and Fitting
Interpolated Curves
2D Interpolated Curves
AMCAX::GeomAPIInterpolate2 is used to compute 2D interpolated curves.
std::vector<AMCAX::Point2> points = {
};
std::vector<double> parameters = { 0.0, 0.25, 0.5, 0.75, 1.0 };
bool periodic = false;
interpolate.Perform();
if (interpolate.IsDone())
{
std::shared_ptr<AMCAX::Geom2BSplineCurve> curve2d = interpolate.Curve();
}
else
std::cout << "error:interpolate failed" << std::endl;
Class of computing a curve interpolating 2D points.
Definition GeomAPIInterpolate2.hpp:18
Additionally, you can add tangent vector constraints during interpolation using AMCAX::GeomAPIInterpolate2::Load to control the shape of the generated curve. You can add tangents for all points or only for the start and end points. For the above example:
Adding tangents for all points as constraints:
std::vector<AMCAX::Vector2> tangents1 = {
};
std::vector<bool> tangentFlags1 = { true, true, true, true, true };
interpolate.Load(tangents1, tangentFlags1, true);
VectorT< double, 2 > Vector2
2D vector
Definition VectorT.hpp:704
Adding tangents for the start and end points as constraints:
interpolate.Load(firstTangent, lastTangent, true);
3D Interpolated Curves
AMCAX::GeomAPIInterpolate3 is used to compute 3D interpolated curves.
std::vector<AMCAX::Point3> points2 = {
};
std::vector<double> parameters2 = { 0.0, 0.25, 0.5, 0.75, 1.0 };
bool periodic2 = false;
interpolate2.Perform();
if (interpolate2.IsDone()) {
std::shared_ptr<AMCAX::Geom3BSplineCurve> curve3d = interpolate2.Curve();
}
else {
std::cout << "error: interpolate failed" << std::endl;
}
Class of computing a curve interpolating 3D points.
Definition GeomAPIInterpolate3.hpp:18
Additionally, tangent vector constraints can be added during the interpolation process using AMCAX::GeomAPIInterpolate3::Load to control the shape of the generated curve. Tangent vectors can be added as constraints for all points or only for the start and end points. Using the above example:
Adding tangent vectors for all points as constraints:
std::vector<AMCAX::Vector3> tangents2 = {
};
std::vector<bool> tangentFlags2 = { true, true, true, true, true };
interpolate2.Load(tangents2, tangentFlags2, true);
VectorT< double, 3 > Vector3
3D vector
Definition VectorT.hpp:707
Adding tangent vectors for the start and end points as constraints:
interpolate2.Load(firstTangent3, lastTangent3, true);
Curve Fitting
2D Curve Fitting
AMCAX::GeomAPIPointsToBSpline2 is used to compute a 2D fitted curve.
std::vector<AMCAX::Point2> points3 = {
};
std::vector<double> parameters3 = { 0.0, 0.25, 0.5, 0.75, 1.0 };
int degMin1 = 3;
int degMax1 = 8;
double tol1 = 1e-3;
if (bsplineFitter1.IsDone()) {
std::shared_ptr<AMCAX::Geom2BSplineCurve> BSplineCurve2d = bsplineFitter1.Curve();
}
else {
std::cout << "error: Bspline curve fitting failed" << std::endl;
}
Class of computing a 2D B spline curve approximating 2D points.
Definition GeomAPIPointsToBSpline2.hpp:19
ContinuityType
Type of continuity.
Definition GeometryMacros.hpp:81
Additionally, a B-spline curve can be fitted based on the starting point's x-coordinate, a constant increment in the x-coordinate, and a set of y-coordinate points. In the following example, the starting point's x-coordinate is 0.0, the constant increment in the x-coordinate is 1.0, and the size of the y-coordinate point set is 5, so the end point's x-coordinate can be inferred as 4.0.
std::vector<double> yValues = {
0.0, 1.0, 0.5, 2.0, 1.5
};
double x0 = 0.0;
double dx = 1.0;
if (bsplineFitter2.IsDone()) {
std::shared_ptr<AMCAX::Geom2BSplineCurve> BSplineCurve2d_2 = bsplineFitter2.Curve();
}
else {
std::cout << "error: Bspline curve fitting failed" << std::endl;
}
3D Curve Fitting
AMCAX::GeomAPIPointsToBSpline3 is used to compute a 3D fitted curve.
std::vector<AMCAX::Point3> points5 = {
};
std::vector<double> parameters4 = { 0.0, 0.25, 0.5, 0.75, 1.0 };
int degMin2 = 3;
int degMax2 = 8;
double tol2 = 1e-3;
if (bsplineFitter2.IsDone()) {
std::shared_ptr<AMCAX::Geom3BSplineCurve> BSplineCurve3d = bsplineFitter3.Curve();
}
else {
std::cout << "error: Bspline curve fitting failed" << std::endl;
}
Class of computing a 3D B spline curve approximating 3D points.
Definition GeomAPIPointsToBSpline3.hpp:19
Surface Fitting
AMCAX::GeomAPIPointsToBSplineSurface is used to compute a fitted surface.
if (bsplineSurfaceFitter.IsDone()) {
std::shared_ptr<AMCAX::Geom3BSplineSurface> bsplinesurface = bsplineSurfaceFitter.Surface();
}
else {
std::cout << "error: Bspline surface fitting failed" << std::endl;
}
Template class of two dimensional array.
Definition Array2.hpp:17
Class of computing a B spline surface approximating points.
Definition GeomAPIPointsToBSplineSurface.hpp:19
Additionally, a B-spline surface can be fitted based on the starting point's x and y coordinates, constant increments in the x and y coordinates, and a set of z-coordinate points.
zPoints(0, 0) = 0.0; zPoints(0, 1) = 1.0; zPoints(0, 2) = 0.0;
zPoints(1, 0) = 1.0; zPoints(1, 1) = 2.0; zPoints(1, 2) = 1.0;
zPoints(2, 0) = 0.0; zPoints(2, 1) = 1.0; zPoints(2, 2) = 0.0;
double x0 = 0.0;
double dx = 1.0;
double y0 = 0.0;
double dy = 1.0;
if (bsplineSurfaceFitter2.IsDone()) {
std::shared_ptr<AMCAX::Geom3BSplineSurface> bsplinesurface2 = bsplineSurfaceFitter2.Surface();
}
else {
std::cout << "error: Bspline surface fitting failed" << std::endl;
}
Intersection of 2D Curves, Curve-Surface Intersection, and Surface-Surface Intersection
2D Curve Intersection
AMCAX::GeomAPIIntCurveCurve2 is used to compute the intersection result of two 2D curves, which may be intersection points or segments.
If the intersection result is points, the number of intersection points can be obtained using AMCAX::GeomAPIIntCurveCurve2::NPoints(), and the coordinates of the intersection points can be obtained using AMCAX::GeomAPIIntCurveCurve2::Point(). Additionally, the parameters of the intersection points on the curves can be obtained using AMCAX::GeomAPIIntCurveCurve2::ParamOnCurve1() and AMCAX::GeomAPIIntCurveCurve2::ParamOnCurve2().
If the intersection result is segments, the number of segments can be obtained using AMCAX::GeomAPIIntCurveCurve2::NSegments(), and a specific segment can be obtained using AMCAX::GeomAPIIntCurveCurve2::Segment().
std::vector<AMCAX::Point2> pts1 = {
};
std::vector<double> knots1 = { 0.0, 0.2, 0.4, 0.6, 0.8, 1.0 };
std::vector<int> mults1 = { 4, 1, 1, 1, 1, 4 };
auto bspline1 = std::make_shared< AMCAX::Geom2BSplineCurve>(pts1, knots1, mults1, 4);
auto circle = std::make_shared<AMCAX::Geom2Circle>(frame, 1.0);
std::cout << cc.NPoints() << std::endl;
std::cout << cc.Point(0) << std::endl;
std::cout << cc.Point(1) << std::endl;
std::cout << cc.ParamOnCurve1(0) << std::endl;
std::cout << cc.ParamOnCurve1(1) << std::endl;
std::cout << cc.ParamOnCurve2(0) << std::endl;
std::cout << cc.ParamOnCurve2(1) << std::endl;
auto trimline1 = std::make_shared<AMCAX::Geom2TrimmedCurve>(line1, 0.0, 3.0);
auto trimline2 = std::make_shared<AMCAX::Geom2TrimmedCurve>(line2, 2.0, 4.0);
std::cout << cc2.NSegments() << std::endl;
std::pair< double, double > paramOnCurve1;
std::pair< double, double > paramOnCurve2;
cc2.Segment(0, paramOnCurve1, paramOnCurve2);
std::cout << paramOnCurve1.first << std::endl;
std::cout << paramOnCurve1.second << std::endl;
std::cout << paramOnCurve2.first << std::endl;
std::cout << paramOnCurve2.second << std::endl;
Class of computing intersection points for two 2D curves.
Definition GeomAPIIntCurveCurve2.hpp:17
Additionally, AMCAX::GeomAPIIntCurveCurve2 can be used to determine if a 2D curve is self-intersecting and to compute the number of self-intersection points.
std::vector<AMCAX::Point2> pts2 = {
};
std::vector<double> knots2 = { 0.0, 0.25, 0.5,0.75,1.0 };
std::vector<int> mults2 = { 4, 1, 1,1,4 };
auto bspline = std::make_shared< AMCAX::Geom2BSplineCurve>(pts2, knots2, mults2, 3);
std::cout << cc3.NPoints() << std::endl;
Curve and Surface Intersection
AMCAX::GeomAPIIntCurveSurface is used to calculate the intersection results between a curve and a surface, where the result could be either a point or a segment.
If the intersection result is a point, the number of points can be obtained through AMCAX::GeomAPIIntCurveSurface::NPoints(), and a specific point's coordinates can be retrieved through AMCAX::GeomAPIIntCurveSurface::Point() at a given index. Additionally, the parameters of the intersection points on both the curve and the surface at a given index can be obtained through AMCAX::GeomAPIIntCurveSurface::Parameters().
If the intersection result is a segment, the number of segments can be obtained through AMCAX::GeomAPIIntCurveSurface::NSegments(). To get a specific segment, it can be retrieved through AMCAX::GeomAPIIntCurveSurface::Segment().
std::vector<AMCAX::Point3> pts3 = {
};
auto bezier = std::make_shared<AMCAX::Geom3BezierCurve>(pts3);
std::shared_ptr<AMCAX::Geom3CylindricalSurface> CylindricalSurface = std::make_shared< AMCAX::Geom3CylindricalSurface>(
AMCAX::Frame3(), 3.0);
std::shared_ptr<AMCAX::Geom3TrimmedSurface> TrimmedSurface = std::make_shared<AMCAX::Geom3TrimmedSurface>(CylindricalSurface, 0., 5., false);
cs.Perform(bezier, TrimmedSurface);
std::cout << cs.IsDone() << std::endl;
std::cout << cs.NPoints() << std::endl;
double u = 0., v = 0., w = 0.;
cs.Parameters(0, u, v, w);
std::cout << "u:" << u << std::endl;
std::cout << "v:" << v << std::endl;
std::cout << "w:" << w << std::endl;
std::cout << "point:" << cs.Point(0) << std::endl;
Class of computing intersection points for a curve and a surface.
Definition GeomAPIIntCurveSurface.hpp:18
Surface and Surface Intersection
AMCAX::GeomAPIIntSurfaceSurface is used to calculate the intersection results between two surfaces. The number of intersection curves can be obtained through AMCAX::GeomAPIIntSurfaceSurface::NLines(). If you want to retrieve a specific intersection curve, you can get it using AMCAX::GeomAPIIntSurfaceSurface::Line().
std::shared_ptr<AMCAX::Geom3CylindricalSurface> CylindricalSurface3 = std::make_shared< AMCAX::Geom3CylindricalSurface>(
AMCAX::Frame3(), 2.0);
std::shared_ptr<AMCAX::Geom3TrimmedSurface> trimcylinder = std::make_shared<AMCAX::Geom3TrimmedSurface>(CylindricalSurface3, 0., 5., false);
auto plane2 = std::make_shared<AMCAX::Geom3Plane>(frame2);
std::shared_ptr<AMCAX::Geom3TrimmedSurface> trimplane2 = std::make_shared<AMCAX::Geom3TrimmedSurface>(plane2, 0., 5., 0., 5.);
std::cout << ss.IsDone() << std::endl;
std::cout << ss.NLines() << std::endl;
std::shared_ptr< AMCAX::Geom3Curve >line3 = ss.Line(0);
Class of computing intersection curves for two surfaces.
Definition GeomAPIIntSurfaceSurface.hpp:18
Calculating Extreme Values Between Geometrical Objects
Extreme Values Between 2D Curves
AMCAX::GeomAPIExtremaCurveCurve2 is used to calculate the minimum distance points between two 2D curves. For the two input curves, you can first use AMCAX::GeomAPIExtremaCurveCurve2::IsParallel to check if the curves are parallel. If they are parallel, no extreme points exist, and NExtrema() will return 1. When trying to get the closest distance or closest points, an OutOfRange exception will be thrown.If the two curves are not parallel, you can obtain the following information:
AMCAX::GeomAPIExtremaCurveCurve2::NExtrema: Used to obtain the number of minimum distance points.
AMCAX::GeomAPIExtremaCurveCurve2::Points: Used to obtain the minimum distance points.
AMCAX::GeomAPIExtremaCurveCurve2::Distance: Used to obtain the distance between the minimum distance points.
AMCAX::GeomAPIExtremaCurveCurve2::Parameters: Used to obtain the parameters of the minimum distance points.
AMCAX::GeomAPIExtremaCurveCurve2::LowerDistance: Used to obtain the minimum distance between the extreme points.
AMCAX::GeomAPIExtremaCurveCurve2::LowerDistanceParameters: Used to obtain the parameters of the extreme points with the minimum distance between the two curves.
std::vector<AMCAX::Point2> pts1 = {
};
std::vector<double> knots1 = { 0.0, 0.2, 0.4, 0.6, 0.8, 1.0 };
std::vector<int> mults1 = { 4, 1, 1, 1, 1, 4 };
auto bspline1 = std::make_shared< AMCAX::Geom2BSplineCurve>(pts1, knots1, mults1, 4);
std::vector<AMCAX::Point2> pts2;
for (const auto& pt : pts1) {
}
auto bspline2 = std::make_shared<AMCAX::Geom2BSplineCurve>(pts2, knots1, mults1, 4);
AMCAX::GeomAPIExtremaCurveCurve2 ex(bspline1, bspline2, bspline1->FirstParameter(), bspline1->LastParameter(), bspline2->FirstParameter(), bspline2->LastParameter());
if (ex.IsParallel())
{
double dist = ex.LowerDistance();
}
else
{
if (ex.NExtrema() > 0)
{
ex.NearestPoints(p1, p2);
double param1, param2;
ex.LowerDistanceParameters(param1, param2);
double nearestdist = ex.LowerDistance();
std::cout << "p1:" << p1 << std::endl;
std::cout << "p2:" << p2 << std::endl;
std::cout << "param1:" << param1 << std::endl;
std::cout << "param2:" << param2 << std::endl;
std::cout << "nearestdist:" << nearestdist << std::endl;
}
for (int i = 0; i < ex.NExtrema(); i++)
{
ex.Points(i, p1, p2);
double param1, param2;
ex.Parameters(i, param1, param2);
std::cout << "the" <<" " << i <<" " << "extremal point:" << std::endl;
std::cout << "p1: " << p1 << std::endl;
std::cout << "p2: " << p2 << std::endl;
std::cout << "param1: " << param1 << std::endl;
std::cout << "param2: " << param2 << std::endl;
std::cout << "dist: " << dist << std::endl;
std::cout << std::endl;
}
}
Class of computing extremal points for two 2D curves.
Definition GeomAPIExtremaCurveCurve2.hpp:20
auto Distance(const PointT< OtherScalar, DIM > &other) const noexcept
Compute the Euclidean distance from the other point.
Definition PointT.hpp:180
Extreme Values Between 3D Curves
To be down.
Extreme Values Between Curves and Surfaces
To be down.