AMCAX Kernel 1.0.0.0
Loading...
Searching...
No Matches
Geometry Foundation

Coord

Construction

Using the default constructor will result in the origin of coordinates. You need to input floating-point numbers when constructing. Also, all geometries only support input of floating-point numbers, which will not be specifically mentioned in the future.

Coord3(Three-Dimensional Coordinate)

AMCAX::Coord3 crd1(0.0, 0.0, 2.0);
Coord3d Coord3
3D coordinate
Definition CoordT.hpp:2810

Coord2(Two-Dimensional Coordinate)

AMCAX::Coord2 crd2d(0.0,1.0);
Coord2d Coord2
2D coordinate
Definition CoordT.hpp:2807

Get and Modify

Get

You can use the following two methods to get the value of a particular dimension of the coordinate.

AMCAX::Coord3 crd(0.0, 1.0, 2.0);
double x = crd.X();
double y = crd.Y();
double z = crd.Z();
double x2 = crd[0];
double y2 = crd[1];
double z2 = crd[2];

Modify

You can modify the value of a particular dimension of the coordinate using the following two methods.

AMCAX::Coord3 crd(0.0, 1.0, 2.0);
crd.SetXYZ(1.0, 0.0, 2.1);
crd.SetX(0.5);
crd.SetY(0.5);
crd.SetZ(0.5);

Common Function

Operation

Support addition, subtraction, scalar multiplication, dot product, cross product, and also support == and !=.

Addition and Subtraction

AMCAX::Coord3 crd1(2.0, 1.0, 2.0);
AMCAX::Coord3 crd2(0.2, 1.0, 1.0);
//+
AMCAX::Coord3 crd3 = crd1 + crd2;
//-
AMCAX::Coord3 crd4 = crd1 - crd2;

Scalar Multiplication

AMCAX::Coord3 crd5 = crd1 * 0.5;

Dot Product

double t = crd1.Dot(crd2);

Cross Product

AMCAX::Coord3 crd6 = crd1.Cross(crd2);

== and !=

== and != can be used to compare coordinates and their respective dimensions.

double result1 = crd1 == crd2;
std::cout << result1 << std::endl;
double result2 = crd1 != crd2;
std::cout << result2 << std::endl;
double result3 = crd1.Y() == crd2.Y();
std::cout << result3 << std::endl;

Norm

The kernel support calculating the norm (magnitude) of the coordinate and normalizing the coordinate.

Magnitude

double length = crd1.Norm();

Normalization

There are two ways to normalize a coordinate: one does not change the coordinate itself and creates a new coordinate, while the other directly modifies the coordinate.

AMCAX::Coord3 crd2 = crd.Normalized();
//change
crd.Normalize();

Output and Input

The kernel support outputting coordinates using << and inputting with >>.

Output

std::cout << crd1 << std::endl;

Input

std::istringstream is("0.0 1.0 2.0");
is >> crd7;

Point

Construction

Using the default constructor will result in the origin. It can either be directly created or constructed based on Coord3/Coord2.

Coord3(Three-Dimensional Point)

//Method 1
AMCAX::Point3 p1(0.0, 1.0, 2.0);
//Method 2
AMCAX::Coord3 crd1(0.0, 1.0, 2.0);
AMCAX::Point3 p2(crd1);
PointT< double, 3 > Point3
3D point
Definition PointT.hpp:459

Coord2(Two-Dimensional Point)

//Method 1
AMCAX::Point2 p3(0.0, 1.0);
//Method 2
AMCAX::Coord2 crd2(0.0, 1.0);
AMCAX::Point2 p4(crd2);
PointT< double, 2 > Point2
2D point
Definition PointT.hpp:456

Get and Modify

Get

You can use the following two methods to get the value of a particular dimension of the point.

AMCAX::Point3 p1(0.0, 1.0, 2.0);
//Method 1
double x = p1.X();
double y = p1.Y();
double z = p1.Z();
//Method 2
double x2 = p1[0];
double y2 = p2[1];
double z2 = p3[2];

Modify

You can modify the value of a particular dimension of the point using the following two methods.

AMCAX::Point3 p1(0.0, 1.0, 2.0);
//Method 1
p1.SetCoord(1.0, 0.0, 2.1);
//Method 2
p1.SetX(0.5);
p1.SetY(0.5);
p1.SetZ(0.5);

Common Function

Operation

The kernel does not support arithmetic operations (addition, subtraction, multiplication, division) on points. In fact, most geometries do not support arithmetic operations, except for Coord. This will not be explained further. However, if you need to perform arithmetic on points, you can first obtain the point's Coord, then perform operations on the Coord:

AMCAX::Point3 p1(0.0, 1.0, 2.0);
AMCAX::Point3 p2(1.0, 2.0, 2.0);
const Coord3& crd3 = p1.Coord();
const Coord3& crd4 = p2.Coord();
const Coord3& crd5 = crd3 + crd4;
AMCAX::Point3 p3(crd5);

Calculate the Distance Between Two Points

AMCAX::Point3 p1(0.0, 1.0, 2.0);
AMCAX::Point3 p2(1.0, 2.0, 2.0);
double dis = p1.Distance(p2);

Vector and Direction

Vector3 refers to a mathematical vector with both direction and length, while Direction3 has only direction, with a magnitude of 1.0.

Construction

//Default
AMCAX::Vector3 vec; // (0.0,0.0,0.0)
AMCAX::Direction3 dir; // (1.0, 0.0, 0.0)
std::cout << vec << ' ' << dir << std::endl;
//1
AMCAX::Vector3 vec1(0.1, 2.0, -3.3);
AMCAX::Direction3 dir1(0.1, 2.0, -3.3); // automatically normalized
std::cout << vec1 << ' ' << dir1 << std::endl;
//2
AMCAX::Vector3 vec2(dir1);
AMCAX::Direction3 dir2(vec1);
std::cout << vec2 << ' ' << dir2 << std::endl;
//3
AMCAX::Point3 p1(0.0, 0.0, 0.0);
AMCAX::Point3 p2(1.0, 0.0, 0.0);
AMCAX::Vector3 vec3(p1, p2); // build vector P1P2
std::cout << vec3 << std::endl;
VectorT< double, 3 > Vector3
3D vector
Definition VectorT.hpp:707
DirectionT< double, 3 > Direction3
3D direction
Definition DirectionT.hpp:566

Get and Modify

The access and modification methods for vectors and directions are similar to the Coord class, except that directions are automatically normalized.

Get

To get a particular dimension's value of a vector or direction:

AMCAX::Vector3 vec; // (0.0,0.0,0.0)
AMCAX::Direction3 dir; // (1.0, 0.0, 0.0)
//vector
//Method 1
double x = vec.X();
double y = vec.Y();
double z = vec.Z();
//Method 2
double x2 = vec[0];
double y2 = vec[1];
double z2 = vec[2];
//direction
//Method 1
double x3 = dir.X();
double y3 = dir.Y();
double z3 = dir.Z();
//Method 2
double x4 = dir[0];
double y4 = dir[1];
double z4 = dir[2];
constexpr const Scalar & Z() const noexcept
Get the z component, only available when DIM >= 3.
Definition DirectionT.hpp:171
constexpr const Scalar & Y() const noexcept
Get the y component, only available when DIM >= 2.
Definition DirectionT.hpp:163
constexpr const Scalar & X() const noexcept
Get the x component, only available when DIM >= 1.
Definition DirectionT.hpp:155
constexpr const Scalar & Y() const noexcept
Get y-coordinate, only available when DIM >= 2.
Definition VectorT.hpp:158
constexpr const Scalar & Z() const noexcept
Get z-coordinate, only available when DIM >= 3.
Definition VectorT.hpp:166
constexpr const Scalar & X() const noexcept
Get x-coordinate, only available when DIM >= 1.
Definition VectorT.hpp:150

Modify

To modify a particular dimension's value of a vector or direction:

//vector
//Method 1
vec.SetCoord(0.1, 2.0, -3.3);
//Method 2
vec.SetX(0.1);
vec.SetY(2.0);
vec.SetZ(-3.3);
//direction
//Method 1
dir.SetCoord(0.1, 2.0, -3.3);
//Method 2
dir.SetX(0.1);
dir.SetY(2.0);
dir.SetZ(-3.3);
void SetX(const OtherScalar &x)
Set x component of the direction, with normalization, only available when DIM >= 1.
Definition DirectionT.hpp:101
void SetY(const OtherScalar &y)
Set y component of the direction, with normalization, only available when DIM >= 2.
Definition DirectionT.hpp:113
void SetZ(const OtherScalar &z)
Set z component of the direction, with normalization, only available when DIM >= 3.
Definition DirectionT.hpp:125
DirectionT & SetCoord(T &&... vs)
Set the coordinate by components, with normalization.
Definition DirectionT.hpp:77
constexpr void SetZ(const OtherScalar &z) &noexcept
Set z-coordinate, only available when DIM >= 3.
Definition VectorT.hpp:117
constexpr void SetY(const OtherScalar &y) &noexcept
Set y-coordinate, only available when DIM >= 2.
Definition VectorT.hpp:108
constexpr void SetCoord(T &&... vs) &noexcept
Set the component values.
Definition VectorT.hpp:81
constexpr void SetX(const OtherScalar &x) &noexcept
Set x-coordinate, only available when DIM >= 1.
Definition VectorT.hpp:99

Common Operation

Operation

Vectors can be added, subtracted, and scaled by a number. Directions do not support addition and subtraction. Both vectors and directions support dot and cross products, similar to the Coord class.

Addition and Subtraction

AMCAX::Vector3 vec1(0.1, 2.0, -3.3);
AMCAX::Vector3 vecc(2.1, 1.5, 2.3);
//+
AMCAX::Vector3 vecc1 = vecc + vec1;
//-
AMCAX::Vector3 vecc2 = vecc - vec1;

Scalar Multiplication

AMCAX::Vector3 vecc(2.1, 1.5, 2.3);
AMCAX::Vector3 vecc3 = vecc * 2.0;

Dot Product

//vector
AMCAX::Vector3 vec1(0.1, 2.0, -3.3);
AMCAX::Vector3 vecc(2.1, 1.5, 2.3);
double t = vecc.Dot(vec1);
//direction
AMCAX::Direction3 dir1(0.1, 2.0, -3.3);
AMCAX::Direction3 dirr(2.3, 1.6, 1.3);
double t2 = dirr.Dot(dir1);

Cross Product

//vector
AMCAX::Vector3 vec1(0.1, 2.0, -3.3);
AMCAX::Vector3 vecc(2.1, 1.5, 2.3);
AMCAX::Vector3 vecc4 = vecc.Cross(vec1);
//direction
AMCAX::Direction3 dir1(0.1, 2.0, -3.3);
AMCAX::Direction3 dirr(2.3, 1.6, 1.3);
AMCAX::Direction3 dirr2 = dirr.Cross(dir1);

Angle

The kernel supports computing angles. The Angle() method calculates the angle between vectors, with a range of [0.0, pi]. The AngleWithRef() method computes the angle with a reference direction in 2D, with a range of [-pi, pi]. The sign of the angle depends on whether the coordinate system is right-handed or left-handed.

AMCAX::Direction3 ddir(1.0, 0.0, 0.0), other_dir(0.0, 0.5, 0.5), ref_dir(0.0, 0.0, 1.0);
double angle1 = ddir.Angle(other_dir);
double angle2 = ddir.AngleWithRef(other_dir, ref_dir);

Note: In 2D, only Angle() should be used to calculate rotation.
Additionally, the methods IsOpposite() and IsParallel() can be used to check if vectors or directions are opposite or parallel:

//vector
AMCAX::VectorT<double, 3> v1(1.0, 2.0, 3.0);
AMCAX::VectorT<double, 3> v2(-1.0, -2.0, -3.0);
AMCAX::VectorT<double, 3> v3(2.0, 4.0, 6.0);
//IsOpposite
bool op1 = v1.IsOpposite(v2, 0.1);
std::cout << op1 << std::endl;
//IsParallel
bool pa1 = v1.IsParallel(v3, 0.1);
std::cout << pa1 << std::endl;
//direction
AMCAX::DirectionT<double, 3> d1(1.0, 2.0, 3.0);
AMCAX::DirectionT<double, 3> d2(-1.0, -2.0, -3.0);
AMCAX::DirectionT<double, 3> d3(2.0, 4.0, 6.0);
//IsOpposite
bool op2 = d1.IsOpposite(d2,0.1);
std::cout << op2 << std::endl;
//IsParallel
bool pa2 = d1.IsParallel(d3, 0.1);
std::cout << pa2 << std::endl;
Class of direction, i.e. the unit vector.
Definition DirectionT.hpp:30
Template class of vector.
Definition VectorT.hpp:30

Magnitude

Vector can compute their magnitude and be normalized, similar to the Coord class.

Magnitude

AMCAX::Vector3 vec1(0.1, 2.0, -3.3);
double length = vec1.Norm();

Normalization

AMCAX::Vector3 vec1(0.1, 2.0, -3.3);
AMCAX::Vector3 vn = vec1.Normalized();
//change
vec1.Normalize();

Axis

Axis3 is an axis in 3D space, equivalent to a Point3 plus a Direction3. Construction is as follows:

AMCAX::Axis3 axis(p, dir);
//Get the location and direction
AMCAX::Point3 p1 = axis.Location();
AMCAX::Direction3 dir1 = axis.Direction();
AxisT< double, 3 > Axis3
3D axis
Definition AxisT.hpp:423

The kernel also supports computing the angle and magnitude of axis:

AMCAX::Axis3 axis(p, dir);
AMCAX::Axis3 axis2(AMCAX::Point3(1.0, 2.0, 3.0), AMCAX::Direction3(0.0, 1.0, 1.0));
double angle = axis.Angle(axis2);

Frame

Definition

Frame3 is a frame in 3D space, consisting of a point and three mutually perpendicular directions.

The world coordinate system {O; x, y, z} is a commonly used frame, and the default constructor of Frame3 creates this frame:

const AMCAX::Point3& p = frame.Location();
//get
const AMCAX::Direction3& x = frame.XDirection();
const AMCAX::Direction3& y = frame.YDirection();
const AMCAX::Direction3& z = frame.Direction();
AMCAX::Frame3 frame2(p, z, x);
constexpr const DirectionT< Scalar, DIM > & XDirection() const noexcept
Get the x direction, only available when DIM >= 1.
Definition FrameT.hpp:451
constexpr const PointT< Scalar, DIM > & Location() const noexcept
Get the location.
Definition FrameT.hpp:435
constexpr const DirectionT< Scalar, DIM > & YDirection() const noexcept
Get the y direction, only available when DIM >= 2.
Definition FrameT.hpp:459
constexpr const DirectionT< Scalar, DIM > & Direction() const noexcept
Get the main direction (z direction) in 3D.
Definition FrameT.hpp:443
FrameT< double, 3 > Frame3
3D frame
Definition FrameT.hpp:887

Note: If the input z-axis is not perpendicular to the x-axis, the algorithm will compute the y-axis as the cross product of z and x, and compute x as the cross product of y and z.

Right-Handed and Left-Handed Systems

The left image shows a right-handed system, and the right image shows a left-handed system (with blue, green, and red representing the x, y, and z axes respectively). The most common local coordinate system is the right-handed system. To determine if a frame is right-handed, curl the fingers of the right hand from x to y, and if the thumb points in the z direction, it is a right-handed system.

The way we kernel to get whether a standard frame is right-handed or not is:

bool isRightHand = frame.IsDirect();
constexpr bool IsDirect() const noexcept
Is the 3D frame right-handed.
Definition FrameT.hpp:522

Local Coordinate System

A frame can represent a local coordinate system, which simplifies the construction of spatial curves and surfaces.

Coordinate Planes

XOY Plane

A standard XOY plane can be constructed in the following two ways.

//Method 1
std::cout << frame1.XDirection() << std::endl;//1 0 0
std::cout << frame1.YDirection() << std::endl;//0 1 0
std::cout << frame1.Direction() << std::endl;//0 0 1
std::cout << frame1.Location() << std::endl;//0 0 0
//Method 2
AMCAX::Frame3 frame2(AMCAX::Point3(0., 0., 0.), AMCAX::Direction3(0., 0., 1.), AMCAX::Direction3(1., 0., 0.));
std::cout << frame2.XDirection() << std::endl;//1 0 0
std::cout << frame2.YDirection() << std::endl;//0 1 0
std::cout << frame2.Direction() << std::endl;//0 0 1
std::cout << frame2.Location() << std::endl;//0 0 0
static AMCAX_API const Frame3 & XOY() noexcept
Get a coordinate system where z-direction is the main direction.

YOZ Plane

A standard YOZ plane can be constructed in the following two ways.

//Method 1
std::cout << frame4.XDirection() << std::endl;//0 1 0
std::cout << frame4.YDirection() << std::endl;//0 0 1
std::cout << frame4.Direction() << std::endl;//1 0 0
std::cout << frame4.Location() << std::endl;//0 0 0
//Method 2
AMCAX::Frame3 frame5(AMCAX::Point3(0., 0., 0.), AMCAX::Direction3(1., 0., 0.), AMCAX::Direction3(0., 1., 0.));
std::cout << frame5.XDirection() << std::endl;//0 1 0
std::cout << frame5.YDirection() << std::endl;//0 0 1
std::cout << frame5.Direction() << std::endl;//1 0 0
std::cout << frame5.Location() << std::endl;//0 0 0
static AMCAX_API const Frame3 & YOZ() noexcept
Get a coordinate system where x-direction is the main direction.

ZOX Plane

A standard ZOX plane can be constructed in the following two ways.

//Method 1
std::cout << frame7.XDirection() << std::endl;//0 0 1
std::cout << frame7.YDirection() << std::endl;//1 0 0
std::cout << frame7.Direction() << std::endl;//0 1 0
std::cout << frame7.Location() << std::endl;//0 0 0
//Method 2
AMCAX::Frame3 frame8(AMCAX::Point3(0., 0., 0.), AMCAX::Direction3(0., 1., 0.), AMCAX::Direction3(0., 0., 1.));
std::cout << frame8.XDirection() << std::endl;//0 0 1
std::cout << frame8.YDirection() << std::endl;//1 0 0
std::cout << frame8.Direction() << std::endl;//0 1 0
std::cout << frame8.Location() << std::endl;//0 0 0
static AMCAX_API const Frame3 & ZOX() noexcept
Get a coordinate system where y-direction is the main direction.

Additionally, in applications, there may be cases involving an XOY plane with a negative Z-axis direction, a YOZ plane with a negative X-axis direction, and a ZOX plane with a negative Y-axis direction.

XOY Plane with Negative Z-axis Direction

AMCAX::Frame3 frame3_2(AMCAX::Point3(0., 0., 0.), AMCAX::Direction3(0., 0., -1.), AMCAX::Direction3(-1., 0., 0.));
std::cout << frame3_2.XDirection() << std::endl;//-1 0 0
std::cout << frame3_2.YDirection() << std::endl;//0 1 0
std::cout << frame3_2.Direction() << std::endl;//0 0 -1
std::cout << frame3_2.Location() << std::endl;//0 0 0

YOZ Plane with Negative X-axis Direction

AMCAX::Frame3 frame6_2(AMCAX::Point3(0., 0., 0.), AMCAX::Direction3(-1., 0., 0.), AMCAX::Direction3(0., -1., 0.));
std::cout << frame6_2.XDirection() << std::endl;//0 -1 0
std::cout << frame6_2.YDirection() << std::endl;//0 0 1
std::cout << frame6_2.Direction() << std::endl;//-1 0 0
std::cout << frame6_2.Location() << std::endl;//0 0 0

ZOX Plane with Negative Y-axis Direction

AMCAX::Frame3 frame9_2(AMCAX::Point3(0., 0., 0.), AMCAX::Direction3(0., -1., 0.), AMCAX::Direction3(0., 0., -1.));
std::cout << frame9_2.XDirection() << std::endl;//0 0 -1
std::cout << frame9_2.YDirection() << std::endl;//1 0 0
std::cout << frame9_2.Direction() << std::endl;//0 -1 0
std::cout << frame9_2.Location() << std::endl;//0 0 0

Transformation

Most geometries support transformations such as translation, rotation, mirror, and scale.

Translation Transformation

AMCAX::TopoShape box = AMCAX::MakeBox(AMCAX::Point3(-5.0, -5.0, 0.0), AMCAX::Point3(5.0, 5.0, 3.0));
trans.SetTranslation(AMCAX::Vector3(1.0, 0.0, 0.0));
Class of making a box.
Definition MakeBox.hpp:20
Base class of shape, containing an underlying shape with a location and an orientation.
Definition TopoShape.hpp:15
Class of transforming a shape.
Definition TransformShape.hpp:12
constexpr void SetTranslation(const VectorT< OtherScalar, DIM > &vec) noexcept
Set the transformation as the translation.
Definition TransformationT.hpp:311
TransformationT< double, 3 > Transformation3
3D transformation
Definition TransformationT.hpp:1115

Rotation Transformation

AMCAX::TopoShape box = AMCAX::MakeBox(AMCAX::Point3(-5.0, -5.0, 0.0), AMCAX::Point3(5.0, 5.0, 3.0));
void SetRotation(const PointT< OtherScalar, DIM > &point, const OtherScalar2 &angle) noexcept
Set the transformation as rotation around a point with an angle in 2D.
Definition TransformationT.hpp:138
constexpr double pi
Mathematical constant Pi, ratio of a circle's circumference to its diameter.
Definition Constants.hpp:42

Mirror Transformation

Point Mirror

AMCAX::TopoShape box = AMCAX::MakeBox(AMCAX::Point3(-5.0, -5.0, 0.0), AMCAX::Point3(5.0, 5.0, 3.0));
trans.SetMirror(AMCAX::Point3(10.,10.,10.));
constexpr void SetMirror(const PointT< OtherScalar, DIM > &point) noexcept
Set the transformation as mirroring by point.
Definition TransformationT.hpp:89

Axis Mirror

AMCAX::TopoShape box = AMCAX::MakeBox(AMCAX::Point3(-5.0, -5.0, 0.0), AMCAX::Point3(5.0, 5.0, 3.0));
trans.SetMirror(AMCAX::Axis3(AMCAX::Point3(10.0, 20.0, 30.0), AMCAX::Direction3(0.0, 1.0, 1.0)));

Plane Mirror

AMCAX::TopoShape box = AMCAX::MakeBox(AMCAX::Point3(-5.0, -5.0, 0.0), AMCAX::Point3(5.0, 5.0, 3.0));
trans.SetMirror(AMCAX::Frame3(AMCAX::Point3(10.0, 10.0, 10.0), AMCAX::Direction3(0.0, 0.0, 1.0)));

Uniform Scale Transformation

AMCAX::TopoShape box = AMCAX::MakeBox(AMCAX::Point3(-5.0, -5.0, 0.0), AMCAX::Point3(5.0, 5.0, 3.0));
trans.SetScale(AMCAX::Point3(), 0.5);
void SetScale(const PointT< OtherScalar, DIM > &point, const OtherScalar2 &s)
Set the transformation as the scaling from a point.
Definition TransformationT.hpp:224

Composite Transformation

The formula for composite transformation is sRx+bsRx+b, where ss is the scaling factor, RR is the rotation matrix, xx is the coordinate to be transformed, and bb is the translation vector.

For example, constructing the following transformation: first rotate around the x-axis by π/4π/4, then scale by a factor of 0.2, and finally translate 1 unit along the x-axis:

AMCAX::TopoShape box = AMCAX::MakeBox(AMCAX::Point3(-5.0, -5.0, 0.0), AMCAX::Point3(5.0, 5.0, 3.0));
trans.SetScaleFactor(0.2);
trans.SetTranslationPart(AMCAX::Vector3(1.0, 0.0, 0.0));
Class of quaternion.
Definition QuaternionT.hpp:19
void SetScaleFactor(const OtherScalar &s)
The the scale factor.
Definition TransformationT.hpp:376
constexpr void SetTranslationPart(const VectorT< OtherScalar, DIM > &vec) noexcept
Set the translation part of the transformation.
Definition TransformationT.hpp:337
void SetRotationPart(const QuaternionT< OtherScalar > &q) noexcept
Set the rotation part of the transformation from a quaternion in 3D.
Definition TransformationT.hpp:176

Transforming an Object from Local Coordinate System to Global (or Another Coordinate System)

Construct a transformation so that the object in the local coordinate system f2={O=(1,0,0), OZ=(1,1,0), OX=(0,0,1)}is transformed to the global coordinate system:

AMCAX::Frame3 f2(AMCAX::Point3(1.0, 0.0, 0.0), AMCAX::Direction3(0.5, 0.5, 0.0), AMCAX::Direction3(0.0, 0.0, 1.0));
trans1.SetTransformation(f2, f1);
constexpr void SetTransformation(const AxisT< OtherScalar, DIM > &axisFrom, const AxisT< OtherScalar2, DIM > &axisTo) noexcept
Set the transformation as the coordinate transformation between two local coordinate systems in 2D.
Definition TransformationT.hpp:254

Transforming Frame 1 by Translating and Rotating to Frame 2

Construct a transformation to change the global coordinate frame to another frame f2={O=(1,0,0), OZ=(1,1,0), OX=(0,0,1)}:

AMCAX::Frame3 f2(AMCAX::Point3(1.0, 0.0, 0.0), AMCAX::Direction3(0.5, 0.5, 0.0), AMCAX::Direction3(0.0, 0.0, 1.0));
AMCAX::TopoShape box11 = AMCAX::MakeBox(f1, 2.0, 2.0, 2.0);
trans2.SetDisplacement(f1, f2);
AMCAX::TopoShape box12 = AMCAX::TransformShape(box11, trans2);
constexpr void SetDisplacement(const FrameT< OtherScalar, DIM > &frameFrom, const FrameT< OtherScalar2, DIM > &frameTo) noexcept
Set the transformation as the transformation of two frames in 3D.
Definition TransformationT.hpp:239

Multiplying Transformations

trans1 * trans2。which applies trans2 first, then trans1:

AMCAX::TopoShape box = AMCAX::MakeBox(AMCAX::Point3(-5.0, -5.0, 0.0), AMCAX::Point3(5.0, 5.0, 3.0));
trans11.SetScaleFactor(0.2);
trans22.SetMirror(AMCAX::Point3(10., 10., 10.));
AMCAX::TopoShape bbox = AMCAX::TransformShape(box, trans11*trans22);