AMCAX Kernel
Geometry kernel for CAD/CAE/CAM
AMCAX Kernel 1.0.0.0
Loading...
Searching...
No Matches
Geometry modeling

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.

//2d
AMCAX::Point2 p(1., 2.);
AMCAX::Line2 l1 = l.Value();
AMCAX::TopoShape line2d = AMCAX::MakeEdge2d(l1, 0., 1.);
AMCAX::OCCTIO::OCCTTool::Write(line2d, "./lind2d.brep");
//3d
AMCAX::Point3 p2(1., 2., 3.);
AMCAX::MakeLine3 ll(p2, d2);
AMCAX::Line3 l2 = ll.Value();
AMCAX::TopoShape line3d = AMCAX::MakeEdge(l2, 0., 1.);
AMCAX::OCCTIO::OCCTTool::Write(line3d, "./lind3d.brep");
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
static AMCAX_API bool Write(const TopoShape &s, std::ostream &os, int format=3)
Write a shape to a stream.
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).

//2d
AMCAX::Frame2 frame2d;
AMCAX::MakeCircle2 c(frame2d, 2.0);
AMCAX::Circle2 c1 = c.Value();
AMCAX::OCCTIO::OCCTTool::Write(circle2d, "./circle2d.brep");
//3d
AMCAX::Frame3 frame3d;
AMCAX::MakeCircle3 cc(frame3d, 2.0);
AMCAX::Circle3 c2 = cc.Value();
AMCAX::OCCTIO::OCCTTool::Write(circle3d, "./circle3d.brep");
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).

//2d
AMCAX::Frame2 frame2d;
AMCAX::MakeEllipse2 e(frame2d, 2.0,1.0);
AMCAX::Ellipse2 e1 = e.Value();
AMCAX::OCCTIO::OCCTTool::Write(ellipse2d, "./ellipse2d.brep");
//3d
AMCAX::Frame3 frame3d;
AMCAX::MakeEllipse3 ee(frame3d, 2.0,1.0);
AMCAX::Ellipse3 e2 = ee.Value();
AMCAX::OCCTIO::OCCTTool::Write(ellipse3d, "./ellipse3d.brep");
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.

//2d
AMCAX::Frame2 frame2d;
AMCAX::MakeHyperbola2 h(frame2d, 2.0, 1.0);
AMCAX::Hyperbola2 h1 = h.Value();
AMCAX::TopoShape hyperbola2d = AMCAX::MakeEdge2d(h1,-1.,1.);
AMCAX::OCCTIO::OCCTTool::Write(hyperbola2d, "./hyperbola2d.brep");
//3d
AMCAX::Frame3 frame3d;
AMCAX::MakeHyperbola3 hh(frame3d, 2.0, 1.0);
AMCAX::Hyperbola3 h2 = hh.Value();
AMCAX::TopoShape hyperbola3d = AMCAX::MakeEdge(h2, -1., 1.);
AMCAX::OCCTIO::OCCTTool::Write(hyperbola3d, "./hyperbola3d.brep");
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.

//2d
AMCAX::Frame2 frame2d;
AMCAX::MakeParabola2 pa(frame2d, 2.0);
AMCAX::Parabola2 pa1 = pa.Value();
AMCAX::TopoShape parabola2d = AMCAX::MakeEdge2d(pa1, -1., 1.);
AMCAX::OCCTIO::OCCTTool::Write(parabola2d, "./parabola2d.brep");
//3d
AMCAX::Frame3 frame3d;
AMCAX::MakeParabola3 paa(frame3d, 2.0);
AMCAX::Parabola3 pa2 = paa.Value();
AMCAX::TopoShape Parabola3d = AMCAX::MakeEdge(pa2, -1., 1.);
AMCAX::OCCTIO::OCCTTool::Write(Parabola3d, "./Parabola3d.brep");
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.

AMCAX::Frame3 frame3d;
AMCAX::MakePlane3 pl(frame3d);
AMCAX::Plane pl1 = pl.Value();
AMCAX::TopoShape plane3d = AMCAX::MakeFace(pl1,0.,2.,0.,2.);
AMCAX::OCCTIO::OCCTTool::Write(plane3d, "./plane3d.brep");
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.

AMCAX::Point3 pp1(0., 0., 0.);
AMCAX::Point3 pp2(1., 2., 3.);
AMCAX::MakeCone3 co(pp1,pp2,2.0,1.0);
AMCAX::Cone co1 = co.Value();
AMCAX::TopoShape cone3d = AMCAX::MakeFace(co1, 0., 2., 0., 2.);
AMCAX::OCCTIO::OCCTTool::Write(cone3d, "./cone3d.brep");
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.

AMCAX::Frame3 frame3d;
AMCAX::MakeCylinder3 cy(frame3d, 2.0);
AMCAX::Cylinder cy1 = cy.Value();
AMCAX::TopoShape cylinder3d = AMCAX::MakeFace(cy1, 0., 2., 0., 2.);
AMCAX::OCCTIO::OCCTTool::Write(cylinder3d, "./cylinder3d.brep");
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.

//2d
AMCAX::MakeGeom2Line geom2line(AMCAX::Point2(0.0, 0.0), AMCAX::Direction2(1.0, 0.0));
std::shared_ptr< AMCAX::Geom2Line > geomline2d = geom2line.Value();
AMCAX::OCCTIO::OCCTTool::Write(AMCAX::MakeEdge2d(geomline2d, 0., 1.),"geomline2d.brep");
//3d
AMCAX::MakeGeom3Line geom3line(AMCAX::Point3(0.0, 0.0,0.0), AMCAX::Direction3(1.0, 0.0,0.0));
std::shared_ptr< AMCAX::Geom3Line > geomline3d = geom3line.Value();
AMCAX::OCCTIO::OCCTTool::Write(AMCAX::MakeEdge(geomline3d, 0., 1.), "geomline3d.brep");
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.

//2d
AMCAX::Frame2 frame2d;
AMCAX::MakeGeom2Circle geom2circle(frame2d, 3.0);
std::shared_ptr< AMCAX::Geom2Circle > geomcircle2d = geom2circle.Value();
AMCAX::OCCTIO::OCCTTool::Write(AMCAX::MakeEdge2d(geomcircle2d), "geomcircle2d.brep");
//3d
AMCAX::Frame3 frame3d;
AMCAX::MakeGeom3Circle geom3circle(frame3d, 2.0);
std::shared_ptr< AMCAX::Geom3Circle > geomcircle3d = geom3circle.Value();
AMCAX::OCCTIO::OCCTTool::Write(AMCAX::MakeEdge(geomcircle3d), "geomcircle3d.brep");
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.

//2d
AMCAX::Frame2 frame2d;
AMCAX::MakeGeom2Ellipse geom2ellipse(frame2d, 2.0, 1.0);
std::shared_ptr< AMCAX::Geom2Ellipse >geomellipse2d = geom2ellipse.Value();
AMCAX::OCCTIO::OCCTTool::Write(AMCAX::MakeEdge2d(geomellipse2d), "geomellipse2d.brep");
//3d
AMCAX::Frame3 frame3d;
AMCAX::MakeGeom3Ellipse geom3ellipse(frame3d, 4.0, 2.0);
std::shared_ptr< AMCAX::Geom3Ellipse >geomellipse3d = geom3ellipse.Value();
AMCAX::OCCTIO::OCCTTool::Write(AMCAX::MakeEdge(geomellipse3d), "geomellipse3d.brep");
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.

//2d
AMCAX::Frame2 frame2d;
AMCAX::MakeGeom2Hyperbola geom2hyperbola(frame2d, 2.0, 1.0);
std::shared_ptr< AMCAX::Geom2Hyperbola > geomhyperbola2d = geom2hyperbola.Value();
AMCAX::OCCTIO::OCCTTool::Write(AMCAX::MakeEdge2d(geomhyperbola2d,-1.0,1.0), "geomhyperbola2d.brep");
//3d
AMCAX::Frame3 frame3d;
AMCAX::MakeGeom3Hyperbola geom3hyperbola(frame3d, 4.0, 2.0);
std::shared_ptr< AMCAX::Geom3Hyperbola > geomhyperbola3d = geom3hyperbola.Value();
AMCAX::OCCTIO::OCCTTool::Write(AMCAX::MakeEdge(geomhyperbola3d, -1.0, 1.0), "geomhyperbola3d.brep");
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.

//2d
AMCAX::Frame2 frame2d;
AMCAX::MakeGeom2Parabola geom2parabola(frame2d, 2.0);
std::shared_ptr< AMCAX::Geom2Parabola > geomparabola2d = geom2parabola.Value();
AMCAX::OCCTIO::OCCTTool::Write(AMCAX::MakeEdge2d(geomparabola2d, -3.0, 3.0), "geomparabola2d.brep");
//3d
AMCAX::Frame3 frame3d;
AMCAX::MakeGeom3Parabola geom3parabola(frame3d, 4.0);
std::shared_ptr< AMCAX::Geom3Parabola > geomparabola3d = geom3parabola.Value();
AMCAX::OCCTIO::OCCTTool::Write(AMCAX::MakeEdge(geomparabola3d, -5.0, 5.0), "geomparabola3d.brep");
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.

AMCAX::MakeGeom3Plane geom3plane(AMCAX::Point3(0.0,0.0,1.0),AMCAX::Direction3(1.,2.,3.));
std::shared_ptr< AMCAX::Geom3Plane > geomplane = geom3plane.Value();
AMCAX::OCCTIO::OCCTTool::Write(AMCAX::MakeFace(geomplane, -1., 1., -1., 1., AMCAX::Precision::Confusion()),"./geompalne.brep");
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.

AMCAX::Frame3 frame3d;
AMCAX::MakeGeom3ConicalSurface geom3conicalsurface(frame3d, 2.0, M_PI_4);
std::shared_ptr< AMCAX::Geom3ConicalSurface > geomconicalsurface = geom3conicalsurface.Value();
AMCAX::OCCTIO::OCCTTool::Write(AMCAX::MakeFace(geomconicalsurface, 0., 2 * M_PI * 2.0, 0., 100., AMCAX::Precision::Confusion()), "./geomconicalsurface.brep");
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();
AMCAX::OCCTIO::OCCTTool::Write(AMCAX::MakeFace(geomcylindricalsurface, 0., 2*2.0*M_PI, 0., 3., AMCAX::Precision::Confusion()), "./geomcylindricalsurface.brep");
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.

//2d
AMCAX::Point2 P2(1., 3.);
AMCAX::MakeSegment2d makesegment2d(P1, P2);
std::shared_ptr< AMCAX::Geom2TrimmedCurve > segment2d = makesegment2d.Value();
AMCAX::OCCTIO::OCCTTool::Write(AMCAX::MakeEdge2d(segment2d), "./segment2d.brep");
//3d
AMCAX::Point3 P4(1.,2.,3.);
AMCAX::MakeSegment makesegment(P3,P4);
std::shared_ptr< AMCAX::Geom3TrimmedCurve > segment3d = makesegment.Value();
AMCAX::OCCTIO::OCCTTool::Write(AMCAX::MakeEdge(segment3d), "./segment3d.brep");
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.

//2d
AMCAX::MakeCircle2 makecircle2(AMCAX::Frame2(), 2.0);
AMCAX::MakeArcOfCircle2d makearcofcircle2d(makecircle2.Value(), 0., 2.,true);
std::shared_ptr< AMCAX::Geom2TrimmedCurve >arcofcircle2d = makearcofcircle2d.Value();
AMCAX::OCCTIO::OCCTTool::Write(AMCAX::MakeEdge2d(arcofcircle2d), "./arcofcircle2d.brep");
//3d
AMCAX::MakeCircle3 makecircle3(AMCAX::Frame3(), 3.0);
AMCAX::MakeArcOfCircle makearcofcircle(makecircle3.Value(), 0., 3.,true);
std::shared_ptr< AMCAX::Geom3TrimmedCurve >arcofcircle3d = makearcofcircle.Value();
AMCAX::OCCTIO::OCCTTool::Write(AMCAX::MakeEdge(arcofcircle3d), "./arcofcircle3d.brep");
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.

//2d
AMCAX::MakeEllipse2 makeellipse2(AMCAX::Frame2(), 2., 1.);
AMCAX::MakeArcOfEllipse2d makearcofellipse2d(makeellipse2.Value(), 0., 2.,true);
std::shared_ptr< AMCAX::Geom2TrimmedCurve > arcofellipse2d = makearcofellipse2d.Value();
AMCAX::OCCTIO::OCCTTool::Write(AMCAX::MakeEdge2d(arcofellipse2d), "./arcofellipse2d.brep");
//3d
AMCAX::MakeEllipse3 makeellipse3(AMCAX::Frame3(), 3., 2.);
AMCAX::MakeArcOfEllipse makearcofellipse(makeellipse3.Value(), 0., 2.,true);
std::shared_ptr< AMCAX::Geom3TrimmedCurve > arcofellipse3d = makearcofellipse.Value();
AMCAX::OCCTIO::OCCTTool::Write(AMCAX::MakeEdge(arcofellipse3d), "./arcofellipse3d.brep");
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.

//2d
AMCAX::MakeHyperbola2 makehyperbola2(AMCAX::Frame2(), 2., 1.);
AMCAX::MakeArcOfHyperbola2d makearcofhyperbola2d(makehyperbola2.Value(), 0., 2.,true);
std::shared_ptr< AMCAX::Geom2TrimmedCurve > arcofhyperbola2d = makearcofhyperbola2d.Value();
AMCAX::OCCTIO::OCCTTool::Write(AMCAX::MakeEdge2d(arcofhyperbola2d), "./arcofhyperbola2d.brep");
//3d
AMCAX::MakeHyperbola3 makehyperbola3(AMCAX::Frame3(), 3., 2.);
AMCAX::MakeArcOfHyperbola makearcofhyperbola(makehyperbola3.Value(), 0., 2.,true);
std::shared_ptr< AMCAX::Geom3TrimmedCurve > arcofhyperbola3d = makearcofhyperbola.Value();
AMCAX::OCCTIO::OCCTTool::Write(AMCAX::MakeEdge(arcofhyperbola3d), "./arcofhyperbola3d.brep");
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.

//2d
AMCAX::MakeParabola2 makeparabola2(AMCAX::Frame2(), 2.);
AMCAX::MakeArcOfParabola2d makearcofparabola2d(makeparabola2.Value(), 0., 2.,true);
std::shared_ptr< AMCAX::Geom2TrimmedCurve > arcofparabola2d = makearcofparabola2d.Value();
AMCAX::OCCTIO::OCCTTool::Write(AMCAX::MakeEdge2d(arcofparabola2d), "./arcofparabola2d.brep");
//3d
AMCAX::MakeParabola3 makeparabola3(AMCAX::Frame3(), 3.);
AMCAX::MakeArcOfParabola makearcofparabola(makeparabola3.Value(), 0., 2.,true);
std::shared_ptr< AMCAX::Geom3TrimmedCurve > arcofparabola3d = makearcofparabola.Value();
AMCAX::OCCTIO::OCCTTool::Write(AMCAX::MakeEdge(arcofparabola3d), "./arcofparabola3d.brep");
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.

AMCAX::MakeTrimmedCone maketrimmedcone(AMCAX::Point3(), AMCAX::Point3(0., 0., 1.), 2., 1.);
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.

AMCAX::MakeTrimmedCylinder maketrimmedcylinder(AMCAX::Point3(), AMCAX::Point3(0., 0., 2.), AMCAX::Point3(2., 0., 0.));
std::shared_ptr< AMCAX::Geom3TrimmedSurface > trimmedcylinder = maketrimmedcylinder.Value();
AMCAX::OCCTIO::OCCTTool::Write(AMCAX::MakeFace(trimmedcylinder, AMCAX::Precision::Confusion()), "./trimmedcylinder.brep");
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().

AMCAX::MakeTrimmedCylinder maketrimmedcylinder(AMCAX::Point3(), AMCAX::Point3(0., 0., 2.), AMCAX::Point3(2., 0., 0.));
std::shared_ptr< AMCAX::Geom3TrimmedSurface > trimmedcylinder = maketrimmedcylinder.Value();
AMCAX::OCCTIO::OCCTTool::Write(AMCAX::MakeFace(trimmedcylinder, AMCAX::Precision::Confusion()), "./trimmedcylinder.brep");
std::cout << trimmedcylinder->FirstUParameter();//0
std::cout << trimmedcylinder->LastUParameter();//6.28319
std::cout << trimmedcylinder->FirstVParameter();//0
std::cout << trimmedcylinder->LastVParameter();//2
//1
double u = 2., v = 0.9;
trimmedcylinder->D0(u, v, P);
std::cout << "P:" << P << std::endl;//P:-0.832294 1.81859 0.9
//2
std::cout << trimmedcylinder->Value(u, v) << std::endl;//-0.832294 1.81859 0.9
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 = {
AMCAX::Point2(0.0, 0.0),
AMCAX::Point2(1.0, 1.0),
AMCAX::Point2(2.0, 0.0),
AMCAX::Point2(3.0, -1.0),
AMCAX::Point2(4.0, 0.0)
};
std::vector<double> parameters = { 0.0, 0.25, 0.5, 0.75, 1.0 };
bool periodic = false;
AMCAX::GeomAPIInterpolate2 interpolate(points, parameters, periodic, AMCAX::Precision::Confusion());
interpolate.Perform();
if (interpolate.IsDone())
{
std::shared_ptr<AMCAX::Geom2BSplineCurve> curve2d = interpolate.Curve();
AMCAX::OCCTIO::OCCTTool::Write(AMCAX::MakeEdge2d(curve2d, AMCAX::Point2(0.0, 0.0), AMCAX::Point2(4.0, 0.0)), "./curve2d.brep");
}
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 = {
AMCAX::Vector2(1.0, 0.0),
AMCAX::Vector2(0.0, 1.0),
AMCAX::Vector2(-1.0, 0.0),
AMCAX::Vector2(0.0, -1.0),
AMCAX::Vector2(1.0, 0.0)
};
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:

AMCAX::Vector2 firstTangent(1.0, 0.0);
AMCAX::Vector2 lastTangent(0.0, -1.0);
interpolate.Load(firstTangent, lastTangent, true);

3D Interpolated Curves

AMCAX::GeomAPIInterpolate3 is used to compute 3D interpolated curves.

std::vector<AMCAX::Point3> points2 = {
AMCAX::Point3(0.0, 0.0, 0.0),
AMCAX::Point3(1.0, 1.0, 1.0),
AMCAX::Point3(2.0, 0.0, 2.0),
AMCAX::Point3(3.0, -1.0, 3.0),
AMCAX::Point3(4.0, 0.0, 4.0)
};
std::vector<double> parameters2 = { 0.0, 0.25, 0.5, 0.75, 1.0 };
bool periodic2 = false;
AMCAX::GeomAPIInterpolate3 interpolate2(points2, parameters2, periodic2, AMCAX::Precision::Confusion());
interpolate2.Perform();
if (interpolate2.IsDone()) {
std::shared_ptr<AMCAX::Geom3BSplineCurve> curve3d = interpolate2.Curve();
AMCAX::OCCTIO::OCCTTool::Write(AMCAX::MakeEdge(curve3d, AMCAX::Point3(0.0, 0.0, 0.0), AMCAX::Point3(4.0, 0.0, 4.0)), "./curve3d.brep");
}
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 = {
AMCAX::Vector3(1.0, 0.0, 0.0),
AMCAX::Vector3(0.0, 1.0, 0.0),
AMCAX::Vector3(0.0, 0.0, 1.0),
AMCAX::Vector3(-1.0, 0.0, 0.0),
AMCAX::Vector3(0.0, -1.0, 0.0)
};
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:

AMCAX::Vector3 firstTangent3(1.0, 0.0, 0.0);
AMCAX::Vector3 lastTangent3(0.0, -1.0, 0.0);
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 = {
AMCAX::Point2(0.0, 0.0),
AMCAX::Point2(1.0, 1.0),
AMCAX::Point2(2.0, 0.0),
AMCAX::Point2(3.0, -1.0),
AMCAX::Point2(4.0, 0.0)
};
std::vector<double> parameters3 = { 0.0, 0.25, 0.5, 0.75, 1.0 };
int degMin1 = 3;
int degMax1 = 8;
AMCAX::ContinuityType continuity1 = AMCAX::ContinuityType::C2;
double tol1 = 1e-3;
AMCAX::GeomAPIPointsToBSpline2 bsplineFitter1(points3, parameters3, degMin1, degMax1, continuity1, tol1);
if (bsplineFitter1.IsDone()) {
std::shared_ptr<AMCAX::Geom2BSplineCurve> BSplineCurve2d = bsplineFitter1.Curve();
AMCAX::OCCTIO::OCCTTool::Write(AMCAX::MakeEdge2d(BSplineCurve2d, AMCAX::Point2(0.0, 0.0), AMCAX::Point2(4.0, 0.0)), "./BSplineCurve2d.brep");
}
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;
AMCAX::GeomAPIPointsToBSpline2 bsplineFitter2(yValues, x0, dx, 3, 8, AMCAX::ContinuityType::C2, 1e-6);
if (bsplineFitter2.IsDone()) {
std::shared_ptr<AMCAX::Geom2BSplineCurve> BSplineCurve2d_2 = bsplineFitter2.Curve();
AMCAX::OCCTIO::OCCTTool::Write(AMCAX::MakeEdge2d(BSplineCurve2d_2), "./BSplineCurve2d_2.brep");
}
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 = {
AMCAX::Point3(0.0, 0.0, 0.0),
AMCAX::Point3(1.0, 1.0, 1.0),
AMCAX::Point3(2.0, 0.0, 2.0),
AMCAX::Point3(3.0, -1.0, 3.0),
AMCAX::Point3(4.0, 0.0, 4.0)
};
std::vector<double> parameters4 = { 0.0, 0.25, 0.5, 0.75, 1.0 };
int degMin2 = 3;
int degMax2 = 8;
AMCAX::ContinuityType continuity2 = AMCAX::ContinuityType::C2;
double tol2 = 1e-3;
AMCAX::GeomAPIPointsToBSpline3 bsplineFitter3(points5, parameters4, degMin2, degMax2, continuity2, tol2);
if (bsplineFitter2.IsDone()) {
std::shared_ptr<AMCAX::Geom3BSplineCurve> BSplineCurve3d = bsplineFitter3.Curve();
AMCAX::OCCTIO::OCCTTool::Write(AMCAX::MakeEdge(BSplineCurve3d, AMCAX::Point3(0.0, 0.0, 0.0), AMCAX::Point3(4.0, 0.0, 4.0)), "./BSplineCurve3d.brep");
}
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.

controls(0, 0) = AMCAX::Point3(-6., -6., 0.);
controls(0, 1) = AMCAX::Point3(-3., -6., -2.);
controls(0, 2) = AMCAX::Point3(3., -6., -2.);
controls(0, 3) = AMCAX::Point3(6., -6., 0.);
controls(1, 0) = AMCAX::Point3(-6., -3., -2.);
controls(1, 1) = AMCAX::Point3(-3., -3., -2.);
controls(1, 2) = AMCAX::Point3(3., -3., 2.);
controls(1, 3) = AMCAX::Point3(6., -3., 2.);
controls(2, 0) = AMCAX::Point3(-6., 3., -2.);
controls(2, 1) = AMCAX::Point3(-3., 3., 2.);
controls(2, 2) = AMCAX::Point3(3., 3., -2.);
controls(2, 3) = AMCAX::Point3(6., 3., 2.);
controls(3, 0) = AMCAX::Point3(-6., 6., 0.);
controls(3, 1) = AMCAX::Point3(-3., 6., 2.);
controls(3, 2) = AMCAX::Point3(3., 6., 2.);
controls(3, 3) = AMCAX::Point3(6., 6., 0.);
AMCAX::GeomAPIPointsToBSplineSurface bsplineSurfaceFitter(controls, 3, 8, AMCAX::ContinuityType::C2, 1e-3);
if (bsplineSurfaceFitter.IsDone()) {
std::shared_ptr<AMCAX::Geom3BSplineSurface> bsplinesurface = bsplineSurfaceFitter.Surface();
AMCAX::OCCTIO::OCCTTool::Write(AMCAX::MakeFace(bsplinesurface,AMCAX::Precision::Confusion()), "./BSplineSurface.brep");
}
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.

AMCAX::Array2<double> zPoints(3, 3);
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;
AMCAX::GeomAPIPointsToBSplineSurface bsplineSurfaceFitter2(zPoints, x0, dx, y0, dy, 3, 8, AMCAX::ContinuityType::C2, 1e-3);
if (bsplineSurfaceFitter2.IsDone()) {
std::shared_ptr<AMCAX::Geom3BSplineSurface> bsplinesurface2 = bsplineSurfaceFitter2.Surface();
AMCAX::OCCTIO::OCCTTool::Write(AMCAX::MakeFace(bsplinesurface2, AMCAX::Precision::Confusion()), "./BSplineSurface2.brep");
}
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().

//point
std::vector<AMCAX::Point2> pts1 = {
AMCAX::Point2(0.0, 2.0),
AMCAX::Point2(1.0, 3.0),
AMCAX::Point2(2.0, 1.0),
AMCAX::Point2(3.0, 3.0),
AMCAX::Point2(4.0, 1.0),
AMCAX::Point2(5.0, 3.0),
AMCAX::Point2(6.0, 2.0)
};
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);
AMCAX::Frame2 frame(AMCAX::Point2(3.0, 3.0), AMCAX::Direction2(1.0, 0.0),AMCAX::Direction2(0.0,1.0));
auto circle = std::make_shared<AMCAX::Geom2Circle>(frame, 1.0);
std::cout << cc.NPoints() << std::endl;//2
std::cout << cc.Point(0) << std::endl;//2.59489 2.08573
std::cout << cc.Point(1) << std::endl;//3.40511 2.08573
std::cout << cc.ParamOnCurve1(0) << std::endl;//0.420769
std::cout << cc.ParamOnCurve1(1) << std::endl;//0.579231
std::cout << cc.ParamOnCurve2(0) << std::endl;//4.29529
std::cout << cc.ParamOnCurve2(1) << std::endl;//5.12949
//segment
auto line1 = std::make_shared<AMCAX::Geom2Line>(AMCAX::Point2(0., 0.), AMCAX::Direction2(1., 0.));
auto trimline1 = std::make_shared<AMCAX::Geom2TrimmedCurve>(line1, 0.0, 3.0);
AMCAX::OCCTIO::OCCTTool::Write(AMCAX::MakeEdge2d(trimline1), "trimline1.brep");
auto line2 = std::make_shared<AMCAX::Geom2Line>(AMCAX::Point2(0., 0.), AMCAX::Direction2(1., 0.));
auto trimline2 = std::make_shared<AMCAX::Geom2TrimmedCurve>(line2, 2.0, 4.0);
AMCAX::OCCTIO::OCCTTool::Write(AMCAX::MakeEdge2d(trimline2), "trimline2.brep");
std::cout << cc2.NSegments() << std::endl;//1
std::pair< double, double > paramOnCurve1;
std::pair< double, double > paramOnCurve2;
cc2.Segment(0, paramOnCurve1, paramOnCurve2);
std::cout << paramOnCurve1.first << std::endl;//2
std::cout << paramOnCurve1.second << std::endl;//3
std::cout << paramOnCurve2.first << std::endl;//2
std::cout << paramOnCurve2.second << std::endl;//3
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 = {
AMCAX::Point2(0.5, 0.5),
AMCAX::Point2(1.0, 3.0),
AMCAX::Point2(3.0, 1.0),
AMCAX::Point2(3.8,2.0),
AMCAX::Point2(2.5,3.5),
AMCAX::Point2(1.0,0.5),
AMCAX::Point2(0.3,2.0)
};
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;//2

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

//point
std::vector<AMCAX::Point3> pts3 = {
AMCAX::Point3(0.0, 0.0,0.0),
AMCAX::Point3(2.0, 2.0,2.0),
AMCAX::Point3(4.0, 3.0,5.0),
AMCAX::Point3(6.0,2.0,4.0)
};
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);
AMCAX::GeomAPIIntCurveSurface cs(bezier, TrimmedSurface);
cs.Perform(bezier, TrimmedSurface);
std::cout << cs.IsDone() << std::endl;//1
std::cout << cs.NPoints() << std::endl;//1
double u = 0., v = 0., w = 0.;
cs.Parameters(0, u, v, w);
std::cout << "u:" << u << std::endl;//u:0.660279
std::cout << "v:" << v << std::endl;//v:2.52939
std::cout << "w:" << w << std::endl;//w:0.394911
std::cout << "point:" << cs.Point(0) << std::endl;//point:2.36946 1.84001 2.52939
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.);
ss.Perform(trimcylinder, trimplane2, AMCAX::Precision::Confusion());
std::cout << ss.IsDone() << std::endl;//1
std::cout << ss.NLines() << std::endl;//1
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 = {
AMCAX::Point2(0.0, 2.0),
AMCAX::Point2(1.0, 3.0),
AMCAX::Point2(2.0, 1.0),
AMCAX::Point2(3.0, 3.0),
AMCAX::Point2(4.0, 1.0),
AMCAX::Point2(5.0, 3.0),
AMCAX::Point2(6.0, 2.0)
};
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) {
pts2.push_back(AMCAX::Point2(pt.X() , -pt.Y()));
}
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()) // parallel case, no extremal points, only extremal distance
{
double dist = ex.LowerDistance(); // minimum distance
}
else
{
if (ex.NExtrema() > 0)
{
AMCAX::Point2 p1, p2;
ex.NearestPoints(p1, p2); // get nearest points
double param1, param2;
ex.LowerDistanceParameters(param1, param2); // get parameters of nearest points
double nearestdist = ex.LowerDistance(); // get nearest distance
std::cout << "p1:" << p1 << std::endl;//p1:2.07541 1.9023
std::cout << "p2:" << p2 << std::endl;//p2:2.07541 -1.9023
std::cout << "param1:" << param1 << std::endl;//p1:2.07541 1.9023
std::cout << "param2:" << param2 << std::endl;//p2:2.07541 -1.9023
std::cout << "nearestdist:" << nearestdist << std::endl;//p2:2.07541 -1.9023
}
for (int i = 0; i < ex.NExtrema(); i++)
{
AMCAX::Point2 p1, p2;
ex.Points(i, p1, p2); // get the i-th extremal points
double param1, param2;
ex.Parameters(i, param1, param2); // get the i-th parameters of extremal points
double dist = ex.Distance(i); // get the i-th extremal distance
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.