|
AMCAX Kernel 1.0.0.0
|
There are 4 types of OrientationType: Forward, Reversed, Internal, and External, with Forward and Reversed being the most commonly used. Any level of TopoShape can set its Orientation using SetOrientation() or retrieve its Orientation using Orientation(). If you want to get a TopoShape that only differs in Orientation from the current TopoShape, you can use Orientated().Orientation is independent of geometry and Location, meaning that changing one will not affect any other members.
For an Edge, the Orientation of the starting Vertex is Forward, and the Orientation of the ending Vertex is Reversed. For example, a line segment Edge with two different Vertices will have one with Forward Orientation and the other with Reversed Orientation. Similarly, an Edge formed by a circle with two identical Vertices will still have one Vertex with Forward Orientation and the other with Reversed Orientation.
Note: In this example, because the Edge formed by a circle has two identical Vertices, only one vertex needs to be constructed. In this case, AMCAX::TopoTool::IsClosed(edge) will return true. If two vertices are constructed, AMCAX::TopoTool::IsClosed(edge) will return false.
The Forward direction of an Edge is the direction of curve3d. If there is no curve3d, it's the direction of the pcurve. The direction of a Reversed Edge is opposite to that of the curve.
For example, given three Edges formed using 3d curves on the xoy plane and a Geom3Plane constructed using the natural frame:
Since the direction of the Wire must be counterclockwise in the parameter domain, Reversed Edge0, Forward Edge2, and Forward Edge1 should form the Wire.
If a clockwise Wire is used, i.e., Forward Edge0, Reversed Edge1, and Reversed Edge2, the Face will define the region outside the Wire. Below are the counterclockwise and clockwise Wires:
If the Geom3Plane is constructed using Frame3(O, -OZ, OX), the Wire direction should be clockwise, i.e., Forward Edge0, Reversed Edge1, and Reversed Edge2, ensuring that the Face is correctly defined as the area enclosed by the Wire.
Reversing a Wire is equivalent to reversing the Orientation of each Edge in the Forward Wire.
Reversing a Face changes the direction of the region it encloses to the opposite of the surface normal. Reversing a Face is equivalent to reversing the Orientation of each Wire in the Forward Face.
The method to retrieve the normal of the surface where the Face lies is as follows:
Reversing a Shell changes the direction of the region it encloses to the opposite direction. Reversing a Shell is equivalent to reversing the Orientation of each Face in the Forward Shell.
Reversing a Solid changes the direction of the region it encloses to the opposite direction. Reversing a Solid is equivalent to reversing the Orientation of each Face in the Forward Solid.
Tolerance represents the amount of error in a TopoShape. For example, a vertex on the curve of Edge1 is at Point3(0.0, 0.0, 0.0), and the same vertex on the curve of Edge2 is at Point3(1.0, 0.0, 0.0). With a tolerance of 2.0, these two points can be considered as the same point. In other words, although the geometric points of this vertex on different edges are different, it is still valid as a topological structure.
To obtain the Tolerance of a TopoShape, the method is: AMCAX::TopoTool::Tolerance(). Only structures containing geometric information, such as Vertex, Edge, and Face, have Tolerance. To change the Tolerance, the methods are: AMCAX::TopoBuilder::UpdateVertex(), AMCAX::TopoBuilder::UpdateEdge(), AMCAX::TopoBuilder::UpdateFace().
Next, we will introduce the Tolerance for Vertex, Edge, and Face in turn:
The Tolerance of a Vertex is a predefined value. Its significance is that when the distance from a Point to the Vertex (i.e., the distance from the Point to the Point within the Vertex) is less than or equal to the Tolerance, the Point is considered to lie on the Vertex. The Point in a Vertex can come from various sources: the Point3 itself, the value of a Curve at a certain parameter, or the value of a Surface at certain u,v parameters. The Tolerance of the Vertex must be no less than the maximum distance between these points.
The Tolerance of an Edge is a predefined value. Its significance is that when the distance from a Point to the Edge is less than or equal to the Tolerance, the Point is considered to lie on the Edge. Additionally, an Edge has a curve3d and a pcurve, where the pcurve can be used to construct an equivalent curve3d through a Surface. The maximum distance between multiple curve3d samples must not exceed the Tolerance of the Edge. If this condition is not met, the Tolerance of the Edge must be increased. Furthermore, the Tolerance of a Vertex must be greater than or equal to the Tolerance of the Edge it lies on.
The Tolerance of a Face is a predefined value. Its significance is that when the distance from a Point to the Face is less than or equal to the Tolerance, the Point is considered to lie on the Face. This is often used in Boolean operations. Additionally, the Tolerance of a Vertex or Edge must be greater than or equal to the Tolerance of the Face they lie on.
Note: When there is a dependency relationship, the Tolerance of a Vertex must be greater than or equal to the Tolerance of an Edge, and the Tolerance of an Edge must be greater than or equal to the Tolerance of a Face.
Whether a TopoShape is closed is a crucial flag. We can use AMCAX::TopoTool::IsClosed() to determine if a TopoShape is closed. This should be distinguished from AMCAX::TopoShape::Closed(), which returns a boolean flag that can be arbitrarily defined by the user. For example, even if a line segment is constructed into an Edge that is not closed, it can still be set as closed using AMCAX::TopoShape::Closed(true).
On the other hand, AMCAX::TopoTool::IsClosed() performs a topological check on certain types of TopoShape. Below is an explanation of how AMCAX::TopoTool::IsClosed() works for different ShapeType inputs.
AMCAX::TopoTool::IsClosed() is used to determine whether the FirstVertex and LastVertex of an Edge are the same (IsSame).
AMCAX::TopoTool::IsClosed() is used to determine whether a Wire has no boundary Vertex, meaning that each Vertex in the Wire appears an even number of times.
AMCAX::TopoTool::IsClosed() is used to determine whether a Shell has no boundary Edge (free Edge), meaning that each Edge in the Shell (excluding degenerate edges) appears an even number of times.
For TopoShape types other than Edge, Wire, and Shell, the result of AMCAX::TopoTool::IsClosed() is the same as the result of AMCAX::TopoShape::Closed().