Poly
OCCT package Poly: Poly, Poly_ArrayOfNodes, Poly_ArrayOfUVNodes, Poly_CoherentLink, and 22 more bound classes.
Poly
This package provides classes and services to handle:
- 3D triangular polyhedrons.
- 3D polygons.
- 2D polygon.
- Tools to dump, save and restore those objects.
Constructors(1)
- constructor(): Poly
Static methods(5)
Computes and stores the link from nodes to triangles and from triangles to neighbouring triangles. This tool is obsolete, replaced by
Poly_CoherentTriangulationAlgorithm to make minimal loops in a graph Join several triangulations to one new triangulation object. The new triangulation is just a mechanical sum of input triangulations, without node sharing. UV coordinates are dropped in the result.Parameters (1)lstTri
- ComputeNormals(Tri: Poly_Triangulation): void
Compute node normals for face triangulation as mean normal of surrounding triangles.
Parameters (1)Tri
Computes parameters of the point P on triangle defined by points P1, P2, and P3, in 2d. The parameters U and V are defined so that P = P1 + U * (P2 - P1) + V * (P3 - P1), with U >= 0, V >= 0, U + V <= 1. If P is located outside of triangle, or triangle is degenerated, the returned parameters correspond to closest point, and returned value is square of the distance from original point to triangle (0 if point is inside).
Parameters (5)P1P2P3PUV—Mutated in place; read the updated value from this argument after the call.
- Intersect(theTri: Poly_Triangulation, theAxis: gp_Ax1, theIsClosest: boolean, theTriangle: Poly_Triangle, theDistance: number): { returnValue: boolean; theDistance: number }
Computes the intersection between axis and triangulation.
Parameters (5)theTri—input triangulationtheAxis—intersecting raytheIsClosest—finds the closest intersection when TRUE, finds the farthest otherwisetheTriangle—intersected triangle Mutated in place; read the updated value from this argument after the call.theDistance—distance along ray to intersection point
ReturnsA result object with fields:
returnValue: TRUE if intersection takes place, FALSE otherwise.theDistance: distance along ray to intersection point
- IntersectTriLine(theStart: gp_XYZ, theDir: gp_Dir, theV0: gp_XYZ, theV1: gp_XYZ, theV2: gp_XYZ, theParam: number): { returnValue: number; theParam: number }
Computes the intersection between a triangle defined by three vertexes and a line.
Parameters (6)theStart—picking ray origintheDir—picking ray directiontheV0—first triangle nodetheV1—second triangle nodetheV2—third triangle nodetheParam—param on line of the intersection point
ReturnsA result object with fields:
returnValue: 1 if intersection was found, 0 otherwise.theParam: param on line of the intersection point
Poly_ArrayOfNodes
Defines an array of 3D nodes of single/double precision configurable at construction time.
Constructors(4)
Empty constructor of double-precision array.
- constructor(theLength: number): Poly_ArrayOfNodes
Constructor of double-precision array.
Parameters (1)theLength
- constructor(theOther: Poly_ArrayOfNodes): Poly_ArrayOfNodes
Copy constructor.
Parameters (1)theOther
- constructor(theBegin: gp_Pnt, theLength: number): Poly_ArrayOfNodes
Constructor wrapping pre-allocated C-array of values without copying them.
Parameters (2)theBegintheLength
Instance methods(6)
- IsDoublePrecision(): boolean
Returns TRUE if array defines nodes with double precision.
- SetDoublePrecision(theIsDouble: boolean): void
Sets if array should define nodes with double or single precision. Raises exception if array was already allocated.
Parameters (1)theIsDouble
- Assign(theOther: Poly_ArrayOfNodes): Poly_ArrayOfNodes
Copies data of theOther array to this. The arrays should have the same length, but may have different precision / number of components (data conversion will be applied in the latter case).
Parameters (1)theOther
- Move(theOther: Poly_ArrayOfNodes): Poly_ArrayOfNodes
Move assignment.
Parameters (1)theOther—Mutated in place; read the updated value from this argument after the call.
A generalized accessor to point.
Parameters (1)theIndex
A generalized setter for point.
Parameters (2)theIndextheValue
Poly_ArrayOfUVNodes
Defines an array of 2D nodes of single/double precision configurable at construction time.
Constructors(4)
Empty constructor of double-precision array.
- constructor(theLength: number): Poly_ArrayOfUVNodes
Constructor of double-precision array.
Parameters (1)theLength
- constructor(theOther: Poly_ArrayOfUVNodes): Poly_ArrayOfUVNodes
Copy constructor.
Parameters (1)theOther
- constructor(theBegin: gp_Pnt2d, theLength: number): Poly_ArrayOfUVNodes
Constructor wrapping pre-allocated C-array of values without copying them.
Parameters (2)theBegintheLength
Instance methods(6)
- IsDoublePrecision(): boolean
Returns TRUE if array defines nodes with double precision.
- SetDoublePrecision(theIsDouble: boolean): void
Sets if array should define nodes with double or single precision. Raises exception if array was already allocated.
Parameters (1)theIsDouble
- Assign(theOther: Poly_ArrayOfUVNodes): Poly_ArrayOfUVNodes
Copies data of theOther array to this. The arrays should have the same length, but may have different precision / number of components (data conversion will be applied in the latter case).
Parameters (1)theOther
- Move(theOther: Poly_ArrayOfUVNodes): Poly_ArrayOfUVNodes
Move assignment.
Parameters (1)theOther—Mutated in place; read the updated value from this argument after the call.
A generalized accessor to point.
Parameters (1)theIndex
A generalized setter for point.
Parameters (2)theIndextheValue
Poly_CoherentLink
Link between two mesh nodes that is created by existing triangle(s). Keeps reference to the opposite node of each incident triangle. The referred node with index "0" is always on the left side of the link, the one with the index "1" is always on the right side. It is possible to find both incident triangles using the method Poly_CoherentTriangulation::FindTriangle().
Any Link can store an arbitrary pointer that is called Attribute.
Constructors(3)
Empty constructor.
- constructor(iNode0: number, iNode1: number): Poly_CoherentLink
Constructor. Creates a Link that has no reference to 'opposite nodes'. This constructor is useful to create temporary object that is not inserted into any existing triangulation.
Parameters (2)iNode0iNode1
- constructor(theTri: Poly_CoherentTriangle, iSide: number): Poly_CoherentLink
Constructor, takes a triangle and a side. A link is created always such that myNode[0] < myNode[1]. Unlike the previous constructor, this one assigns the 'opposite node' fields. This constructor is used when a link is inserted into a
Poly_CoherentTriangulationstructure.Parameters (2)theTri—Triangle containing the link that is creatediSide—Can be 0, 1 or 2. Index of the node
Instance methods(4)
- Node(ind: number): number
Return the node index in the current triangulation.
Parameters (1)ind—0 or 1 making distinction of the two nodes that constitute the Link. Node(0) always returns a smaller number than Node(1).
- OppositeNode(ind: number): number
Return the opposite node (belonging to the left or right incident triangle) index in the current triangulation.
Parameters (1)ind—0 or 1 making distinction of the two involved triangles: 0 on the left, 1 on the right side of the Link.
- IsEmpty(): boolean
Query the status of the link - if it is an invalid one. An invalid link has Node members equal to -1.
- Nullify(): void
Invalidate this Link.
Poly_CoherentNode
Node of coherent triangulation. Contains:
- Coordinates of a 3D point defining the node location
- 2D point coordinates
- List of triangles that use this Node
- Integer index, normally the index of the node in the original triangulation
Constructors(2)
Empty constructor.
- constructor(thePnt: gp_XYZ): Poly_CoherentNode
Constructor.
Parameters (1)thePnt
Instance methods(12)
- SetUV(theU: number, theV: number): void
Set the UV coordinates of the Node.
Parameters (2)theUtheV
- GetU(): number
Get U coordinate of the Node.
- GetV(): number
Get V coordinate of the Node.
Define the normal vector in the Node.
Parameters (1)theVector
- HasNormal(): boolean
Query if the Node contains a normal vector.
Get the stored normal in the node.
- SetIndex(theIndex: number): void
Set the value of node Index.
Parameters (1)theIndex
- GetIndex(): number
Get the value of node Index.
- IsFreeNode(): boolean
Check if this is a free node, i.e., a node without a single incident triangle.
- Clear(argNo0: NCollection_BaseAllocator): void
Reset the Node to void.
Parameters (1)argNo0
- AddTriangle(theTri: Poly_CoherentTriangle, theA: NCollection_BaseAllocator): void
Connect a triangle to this Node.
Parameters (2)theTritheA
- RemoveTriangle(theTri: Poly_CoherentTriangle, theA: NCollection_BaseAllocator): boolean
Disconnect a triangle from this Node.
Parameters (2)theTritheA
Poly_CoherentTriangle
Data class used in Poly_CoherentTriangultion. Implements a triangle with references to its neighbours.
Constructors(2)
Empty constructor.
- constructor(iNode0: number, iNode1: number, iNode2: number): Poly_CoherentTriangle
Constructor.
Parameters (3)iNode0iNode1iNode2
Instance methods(11)
- Node(ind: number): number
Query the node index in the position given by the parameter 'ind'
Parameters (1)ind
- IsEmpty(): boolean
Query if this is a valid triangle.
- SetConnection(iConn: number, theTr: Poly_CoherentTriangle): boolean
Create connection with another triangle theTri. This method creates both connections: in this triangle and in theTri. You do not need to call the same method on triangle theTr.
Parameters (2)iConn—Can be 0, 1 or 2 - index of the node that is opposite to the connection (shared link).theTr—Triangle that is connected on the given link. Mutated in place; read the updated value from this argument after the call.
ReturnsTrue if successful, False if the connection is rejected due to improper topology.
- SetConnection(theTri: Poly_CoherentTriangle): boolean
Create connection with another triangle theTri. This method creates both connections: in this triangle and in theTri. This method is slower than the previous one, because it makes analysis what sides of both triangles are connected.
Parameters (1)theTri—Triangle that is connected. Mutated in place; read the updated value from this argument after the call.
ReturnsTrue if successful, False if the connection is rejected due to improper topology.
- RemoveConnection(iConn: number): void
Remove the connection with the given index.
Parameters (1)iConn—Can be 0, 1 or 2 - index of the node that is opposite to the connection (shared link).
- RemoveConnection(theTri: Poly_CoherentTriangle): boolean
Remove the connection with the given Triangle.
Parameters (1)theTri—Mutated in place; read the updated value from this argument after the call.
ReturnsTrue if successfuol or False if the connection has not been found.
- NConnections(): number
Query the number of connected triangles.
- GetConnectedNode(iConn: number): number
Query the connected node on the given side. Returns -1 if there is no connection on the specified side.
Parameters (1)iConn
- GetConnectedTri(iConn: number): Poly_CoherentTriangle
Query the connected triangle on the given side. Returns NULL if there is no connection on the specified side.
Parameters (1)iConn
- GetLink(iLink: number): Poly_CoherentLink
Query the Link associate with the given side of the Triangle. May return NULL if there are no links in the triangulation.
Parameters (1)iLink
- FindConnection(argNo0: Poly_CoherentTriangle): number
Returns the index of the connection with the given triangle, or -1 if not found.
Parameters (1)argNo0
Poly_CoherentTriangulation
Definition of HANDLE object using Standard_DefineHandle.hxx.
Triangulation structure that allows to:
- Store the connectivity of each triangle with up to 3 neighbouring ones and with the corresponding 3rd nodes on them,
- Store the connectivity of each node with all triangles that share this node
- Add nodes and triangles to the structure,
- Find all triangles sharing a single or a couple of nodes
- Remove triangles from structure
- Optionally create Links between pairs of nodes according to the current triangulation.
- Convert from/to
Poly_Triangulationstructure.
This class is useful for algorithms that need to analyse and/or edit a triangulated mesh - for example for mesh refining. The connectivity model follows the idea that all Triangles in a mesh should have coherent orientation like on a surface of a solid body. Connections between more than 2 triangles are not supported.
Architecture
The data types used in this structure are: Poly_CoherentNode: Inherits go_XYZ therefore provides the full public API ofgp_XYZ. Contains references to all incident triangles. You can add new nodes but you cannot remove existing ones. However each node that has no referenced triangle is considered as "free" (use the method IsFreeNode() to check this). Free nodes are not available to further processing, particularly they are not exported inPoly_Triangulation.Poly_CoherentTriangle: Main data type. Refers three Nodes, three connected Triangles, three opposite (connected) Nodes and three Links.
If there is boundary then 1, 2 or 3 references to Triangles/connected Nodes/Links are assigned to NULL (for pointers) or -1 (for integer node index).
You can find a triangle by one node using its triangle iterator or by two nodes - creating a temporaryPoly_CoherentLinkand calling the methodFindTriangle(). Triangles can be removed but they are never deleted from the containing array. Removed triangles have all nodes equal to -1. You can use the method IsEmpty() to check that.Poly_CoherentLink: Auxiliary data type. Normally the array of Links is empty, because for many algorithms it is sufficient to define only Triangles. You can explicitly create the Links at least once, calling the methodComputeLinks(). Each Link is oriented couple ofPoly_CoherentNode(directed to the ascending Node index).
It refers two connected triangulated Nodes - on the left and on the right, therefore aPoly_CoherentLinkinstance refers the full set of nodes that constitute a couple of connected Triangles. A boundary Link has either the first (left) or the second (right) connected node index equal to -1.
When the array of Links is created, all subsequent calls to AddTriangle and RemoveTriangle try to preserve the connectivity Triangle-Link in addition to the connectivity Triangle-Triangle.
Particularly, new Links are created by methodAddTriangle()and existing ones are removed by methodRemoveTriangle(), in each case whenever necessary.
Similarly toPoly_CoherentTriangle, a Link can be removed but not destroyed separately from others. Removed Link can be recogniosed using the method IsEmpty(). To destroy all Links, call the methodClearLinks(), this method also nullifies Link references in all Triangles.
All objects (except for free Nodes and empty Triangles and Links) can be visited by the correspondingIterator. Direct access is provided only for Nodes (needed to resolve Node indexed commonly used as reference).
Triangles and Links can be retrieved by their index only internally, the public API provides only references or pointers to C++ objects.
If you need a direct access to Triangles and Links, you can subclassPoly_CoherentTriangulationand use the protected API for your needs.
Memory management: All data objects are stored inNCollection_DynamicArraycontainers that prove to be efficient for the performance.
In addition references to triangles are stored in ring lists, with an instance of such list perPoly_CoherentNode.
These lists are allocated in a memory allocator that is provided in the constructor ofPoly_CoherentTriangulation. By default the standard OCCT allocator (akaNCollection_BaseAllocator) is used.
But if you need to increase the performance you can useNCollection_IncAllocatorinstead.
Constructors(2)
Empty constructor.
Parameters (1)theAlloc
- constructor(theTriangulation: Poly_Triangulation, theAlloc?: NCollection_BaseAllocator): Poly_CoherentTriangulation
Constructor. It does not create Links, you should call ComputeLinks following this constructor if you need these links.
Parameters (2)theTriangulationtheAlloc
Static methods(2)
- get_type_name(): string
Instance methods(25)
Create an instance of
Poly_Triangulationfrom this object.- RemoveDegenerated(theTol: number, pLstRemovedNode?: any): boolean
Find and remove degenerated triangles in Triangulation.
Parameters (2)theTol—Tolerance for the degeneration case. If any two nodes of a triangle have the distance less than this tolerance, this triangle is considered degenerated and therefore removed by this method.pLstRemovedNode—Optional parameter. If defined, then it will receive the list of arrays where the first number is the index of removed node and the second - the index of remaining node to which the mesh was reconnected.
- GetFreeNodes(lstNodes: NCollection_List_int): boolean
Create a list of free nodes. These nodes may appear as a result of any custom mesh decimation or
RemoveDegenerated()call. This analysis is necessary if you support additional data structures based on the triangulation (e.g., edges on the surface boundary).Parameters (1)lstNodes—[out]List that receives the indices of free nodes. Mutated in place; read the updated value from this argument after the call.
- MaxNode(): number
Query the index of the last node in the triangulation
- MaxTriangle(): number
Query the index of the last triangle in the triangulation
- SetDeflection(theDefl: number): void
Set the Deflection value as the parameter of the given triangulation.
Parameters (1)theDefl
- Deflection(): number
Query the Deflection parameter (default value 0. - if never initialized)
Initialize a node
Parameters (2)thePntiN—Index of the node. If negative (default), the node is added to the end of the current array of nodes.
ReturnsIndex of the added node.
- Node(i: number): Poly_CoherentNode
Get the node at the given index 'i'.
Parameters (1)i
- ChangeNode(i: number): Poly_CoherentNode
Get the node at the given index 'i'.
Parameters (1)i
- NNodes(): number
Query the total number of active nodes (i.e. nodes used by 1 or more triangles)
- Triangle(i: number): Poly_CoherentTriangle
Get the triangle at the given index 'i'.
Parameters (1)i
- NTriangles(): number
Query the total number of active triangles (i.e. triangles that refer nodes, non-empty ones)
- NLinks(): number
Query the total number of active Links.
- RemoveTriangle(theTr: Poly_CoherentTriangle): boolean
Removal of a single triangle from the triangulation.
Parameters (1)theTr—Mutated in place; read the updated value from this argument after the call.
- RemoveLink(theLink: Poly_CoherentLink): void
Removal of a single link from the triangulation.
Parameters (1)theLink—Mutated in place; read the updated value from this argument after the call.
- AddTriangle(iNode0: number, iNode1: number, iNode2: number): Poly_CoherentTriangle
Add a triangle to the triangulation.
Parameters (3)iNode0iNode1iNode2
ReturnsPointer to the added triangle instance or NULL if an error occurred.
- ReplaceNodes(theTriangle: Poly_CoherentTriangle, iNode0: number, iNode1: number, iNode2: number): boolean
Replace nodes in the given triangle.
Parameters (4)theTriangle—Mutated in place; read the updated value from this argument after the call.iNode0iNode1iNode2
ReturnsTrue if operation succeeded.
- AddLink(theTri: Poly_CoherentTriangle, theConn: number): Poly_CoherentLink
Add a single link to triangulation, based on a triangle and its side index. This method does not check for coincidence with already present links.
Parameters (2)theTri—Triangle that contains the link to be added.theConn—Index of the side (i.e., 0, 1 0r 2) defining the added link.
- FindTriangle(theLink: Poly_CoherentLink, pTri: [Poly_CoherentTriangle, Poly_CoherentTriangle]): boolean
Find one or two triangles that share the given couple of nodes.
Parameters (2)theLink—Link (in fact, just a couple of nodes) on which the triangle is searched.pTri—[out]Array of two pointers to triangle. pTri[0] stores the triangle to the left of the link, while pTri[1] stores the one to the right of the link.
ReturnsTrue if at least one triangle is found and output as pTri.
- ComputeLinks(): number
(Re)Calculate all links in this Triangulation.
- ClearLinks(): void
Clear all Links data from the Triangulation data.
Query the allocator of elements, this allocator can be used for other objects
- Clone(theAlloc: NCollection_BaseAllocator): Poly_CoherentTriangulation
Create a copy of this Triangulation, using the given allocator.
Parameters (1)theAlloc
Poly_CoherentTriangulation_IteratorOfLink
Constructors(1)
- Parameters (1)
theTri
Instance methods(1)
- Next(): void
Poly_CoherentTriangulation_IteratorOfNode
Constructors(1)
- Parameters (1)
theTri
Instance methods(1)
- Next(): void
Poly_CoherentTriangulation_IteratorOfTriangle
Constructors(1)
- Parameters (1)
theTri
Instance methods(1)
- Next(): void
Poly_CoherentTriPtr_Iterator
Constructors(1)
Instance methods(4)
Poly_Connect
Provides an algorithm to explore, inside a triangulation, the adjacency data for a node or a triangle. Adjacency data for a node consists of triangles which contain the node. Adjacency data for a triangle consists of:
- the 3 adjacent triangles which share an edge of the triangle,
- and the 3 nodes which are the other nodes of these adjacent triangles. Example Inside a triangulation, a triangle T has nodes n1, n2 and n3. It has adjacent triangles AT1, AT2 and AT3 where:
- AT1 shares the nodes n2 and n3,
- AT2 shares the nodes n3 and n1,
- AT3 shares the nodes n1 and n2. It has adjacent nodes an1, an2 and an3 where:
- an1 is the third node of AT1,
- an2 is the third node of AT2,
- an3 is the third node of AT3. So triangle AT1 is composed of nodes n2, n3 and an1. There are two ways of using this algorithm.
- From a given node you can look for one triangle that passes through the node, then look for the triangles adjacent to this triangle, then the adjacent nodes. You can thus explore the triangulation step by step (functions Triangle, Triangles and Nodes).
- From a given node you can look for all the triangles that pass through the node (iteration method, using the functions Initialize, More, Next and Value). A Connect object can be seen as a tool which analyzes a triangulation and translates it into a series of triangles. By doing this, it provides an interface with other tools and applications working on basic triangles, and which do not work directly with a
Poly_Triangulation.
Constructors(2)
Constructs an uninitialized algorithm.
- constructor(theTriangulation: Poly_Triangulation): Poly_Connect
Constructs an algorithm to explore the adjacency data of nodes or triangles for the triangulation T.
Parameters (1)theTriangulation
Instance methods(9)
- Load(theTriangulation: Poly_Triangulation): void
Initialize the algorithm to explore the adjacency data of nodes or triangles for the triangulation theTriangulation.
Parameters (1)theTriangulation
Returns the triangulation analyzed by this tool.
- Triangle(N: number): number
Returns the index of a triangle containing the node at index N in the nodes table specific to the triangulation analyzed by this tool.
Parameters (1)N
- Triangles(T: number, t1: number, t2: number, t3: number): { t1: number; t2: number; t3: number }
Returns in t1, t2 and t3, the indices of the 3 triangles adjacent to the triangle at index T in the triangles table specific to the triangulation analyzed by this tool. Warning Null indices are returned when there are fewer than 3 adjacent triangles.
Parameters (4)Tt1t2t3
ReturnsA result object with fields:
t1: updated value from the call.t2: updated value from the call.t3: updated value from the call.
- Nodes(T: number, n1: number, n2: number, n3: number): { n1: number; n2: number; n3: number }
Returns, in n1, n2 and n3, the indices of the 3 nodes adjacent to the triangle referenced at index T in the triangles table specific to the triangulation analyzed by this tool. Warning Null indices are returned when there are fewer than 3 adjacent nodes.
Parameters (4)Tn1n2n3
ReturnsA result object with fields:
n1: updated value from the call.n2: updated value from the call.n3: updated value from the call.
- Initialize(N: number): void
Initializes an iterator to search for all the triangles containing the node referenced at index N in the nodes table, for the triangulation analyzed by this tool. The iterator is managed by the following functions:
- More, which checks if there are still elements in the iterator
- Next, which positions the iterator on the next element
- Value, which returns the current element. The use of such an iterator provides direct access to the triangles around a particular node, i.e. it avoids iterating on all the component triangles of a triangulation. Example
Poly_ConnectC(Tr); for (C.Initialize(n1);C.More();C.Next()) { t = C.Value(); }
Parameters (1)N
- More(): boolean
Returns true if there is another element in the iterator defined with the function Initialize (i.e. if there is another triangle containing the given node).
- Next(): void
Advances the iterator defined with the function Initialize to access the next triangle. Note: There is no action if the iterator is empty (i.e. if the function More returns false).-.
- Value(): number
Returns the index of the current triangle to which the iterator, defined with the function Initialize, points. This is an index in the triangles table specific to the triangulation analyzed by this tool.
Poly_MakeLoops
Make loops from a set of connected links. A link is represented by a pair of integer indices of nodes.
Instance methods(10)
- Reset(theHelper: Poly_MakeLoops_Helper, theAlloc?: NCollection_BaseAllocator): void
It is to reset the algorithm to the initial state.
Parameters (2)theHelpertheAlloc
- AddLink(theLink: Poly_MakeLoops_Link): void
Adds a link to the set. theOrient defines which orientations of the link are allowed.
Parameters (1)theLink
- ReplaceLink(theLink: Poly_MakeLoops_Link, theNewLink: Poly_MakeLoops_Link): void
Replace one link with another (e.g. to change order of nodes).
Parameters (2)theLinktheNewLink
- SetLinkOrientation(theLink: Poly_MakeLoops_Link, theOrient: Poly_MakeLoops_LinkFlag): Poly_MakeLoops_LinkFlag
Set a new value of orientation of a link already added earlier. It can be used with LF_None to exclude the link from consideration. Returns the old value of orientation.
Parameters (2)theLinktheOrient
- FindLink(theLink: Poly_MakeLoops_Link): Poly_MakeLoops_Link
Find the link stored in algo by value.
Parameters (1)theLink
- Perform(): number
Does the work. Returns the collection of result codes.
- GetNbLoops(): number
Returns the number of loops in the result.
- GetLoop(theIndex: number): any
Returns the loop of the given index.
Parameters (1)theIndex
- GetNbHanging(): number
Returns the number of detected hanging chains.
- GetHangingLinks(theLinks: any): void
Fills in the list of hanging links.
Parameters (1)theLinks
Poly_MakeLoops_Hasher
Constructors(1)
Poly_MakeLoops_HeapOfInteger
Constructors(1)
- constructor(theNbPreAllocated?: number): Poly_MakeLoops_HeapOfIntegerParameters (1)
theNbPreAllocated
Instance methods(6)
Poly_MakeLoops_Helper
Instance methods(2)
- GetAdjacentLinks(theNode: number): anyParameters (1)
theNode
- OnAddLink(argNo0: number, argNo1: Poly_MakeLoops_Link): voidParameters (2)
argNo0argNo1
Poly_MakeLoops_Link
Constructors(2)
- constructor(theNode1: number, theNode2: number): Poly_MakeLoops_LinkParameters (2)
theNode1theNode2
Instance methods(4)
- Reverse(): void
- IsReversed(): boolean
- Nullify(): void
- IsNull(): boolean
Properties(3)
Poly_MakeLoops2D_Helper
Instance methods(2)
- GetFirstTangent(theLink: Poly_MakeLoops_Link, theDir: gp_Dir2d): booleanParameters (2)
theLinktheDir
- GetLastTangent(theLink: Poly_MakeLoops_Link, theDir: gp_Dir2d): booleanParameters (2)
theLinktheDir
Poly_MakeLoops3D_Helper
Instance methods(3)
- GetFirstTangent(theLink: Poly_MakeLoops_Link, theDir: gp_Dir): booleanParameters (2)
theLinktheDir
- GetLastTangent(theLink: Poly_MakeLoops_Link, theDir: gp_Dir): booleanParameters (2)
theLinktheDir
- Parameters (2)
theNodetheDir
Poly_MergeNodesTool
Auxiliary tool for merging triangulation nodes for visualization purposes. Tool tries to merge all nodes within input triangulation, but split the ones on sharp corners at specified angle.
Constructors(1)
- constructor(theSmoothAngle: number, theMergeTolerance?: number, theNbFacets?: number): Poly_MergeNodesTool
Constructor.
Parameters (3)theSmoothAngle—smooth angle in radians or 0.0 to disable merging by angletheMergeTolerance—node merging maximum distancetheNbFacets—estimated number of facets for map preallocation
Static methods(3)
- get_type_name(): string
- MergeNodes(theTris: Poly_Triangulation, theTrsf: gp_Trsf, theToReverse: boolean, theSmoothAngle: number, theMergeTolerance?: number, theToForce?: boolean): Poly_Triangulation
Merge nodes of existing mesh and return the new mesh.
Parameters (6)theTris—triangulation to addtheTrsf—transformation to applytheToReverse—reverse triangle nodes ordertheSmoothAngle—merge angle in radianstheMergeTolerance—linear merge tolerancetheToForce—return merged triangulation even if it's statistics is equal to input one
Returnsmerged triangulation or NULL on no result
Instance methods(28)
- MergeTolerance(): number
Return merge tolerance; 0.0 by default (only 3D points with exactly matching coordinates are merged).
- SetMergeTolerance(theTolerance: number): void
Set merge tolerance.
Parameters (1)theTolerance
- MergeAngle(): number
Return merge angle in radians; 0.0 by default (normals with non-exact directions are not merged).
- SetMergeAngle(theAngleRad: number): void
Set merge angle.
Parameters (1)theAngleRad
- ToMergeOpposite(): boolean
Return TRUE if nodes with opposite normals should be merged; FALSE by default.
- SetMergeOpposite(theToMerge: boolean): void
Set if nodes with opposite normals should be merged.
Parameters (1)theToMerge
- SetUnitFactor(theUnitFactor: number): void
Setup unit factor.
Parameters (1)theUnitFactor
- ToDropDegenerative(): boolean
Return TRUE if degenerate elements should be discarded; TRUE by default.
- SetDropDegenerative(theToDrop: boolean): void
Set if degenerate elements should be discarded.
Parameters (1)theToDrop
- ToMergeElems(): boolean
Return TRUE if equal elements should be filtered; FALSE by default.
- SetMergeElems(theToMerge: boolean): void
Set if equal elements should be filtered.
Parameters (1)theToMerge
- computeTriNormal(): [number, number, number]
Compute normal for the mesh element.
- AddTriangulation(theTris: Poly_Triangulation, theTrsf?: gp_Trsf, theToReverse?: boolean): void
Add another triangulation to created one.
Parameters (3)theTris—triangulation to addtheTrsf—transformation to applytheToReverse—reverse triangle nodes order
Prepare and return result triangulation (temporary data will be truncated to result size).
- AddTriangle(theElemNodes: [gp_XYZ, gp_XYZ, gp_XYZ]): void
Add new triangle.
Parameters (1)theElemNodes—3 element nodes
Add new quad.
Parameters (1)theElemNodes—4 element nodes
- AddElement(theElemNodes: gp_XYZ, theNbNodes: number): void
Add new triangle or quad.
Parameters (2)theElemNodes—element nodestheNbNodes—number of element nodes, should be 3 or 4
- ChangeElementNode(theIndex: number): gp_XYZ
Change node coordinates of element to be pushed.
Parameters (1)theIndex—node index within current element, in 0..3 range
- PushLastElement(theNbNodes: number): void
Add new triangle or quad with nodes specified by
ChangeElementNode().Parameters (1)theNbNodes
- PushLastTriangle(): void
Add new triangle with nodes specified by
ChangeElementNode(). - PushLastQuad(): void
Add new quad with nodes specified by
ChangeElementNode(). - ElementNodeIndex(theIndex: number): number
Return current element node index defined by
PushLastElement().Parameters (1)theIndex
- NbNodes(): number
Return number of nodes.
- NbElements(): number
Return number of elements.
- NbDegenerativeElems(): number
Return number of discarded degenerate elements.
- NbMergedElems(): number
Return number of merged equal elements.
Setup output triangulation for modifications. When set to NULL, the tool could be used as a merge map for filling in external mesh structure.
Poly_Polygon2D
Provides a polygon in 2D space (for example, in the parametric space of a surface). It is generally an approximate representation of a curve. A Polygon2D is defined by a table of nodes. Each node is a 2D point. If the polygon is closed, the point of closure is repeated at the end of the table of nodes.
Constructors(2)
- constructor(theNbNodes: number): Poly_Polygon2D
Constructs a 2D polygon with specified number of nodes.
Parameters (1)theNbNodes
Constructs a 2D polygon defined by the table of points, <Nodes>.
Parameters (1)Nodes
Static methods(2)
- get_type_name(): string
Instance methods(6)
- Deflection(): number
Returns the deflection of this polygon. Deflection is used in cases where the polygon is an approximate representation of a curve.
Deflection represents the maximum distance permitted between any point on the curve and the corresponding point on the polygon. By default the deflection value is equal to 0.
An algorithm using this 2D polygon with a deflection value equal to 0 considers that it is working with a true polygon and not with an approximate representation of a curve. The Deflection function is used to modify the deflection value of this polygon. The deflection value can be used by any algorithm working with 2D polygons. For example:- An algorithm may use a unique deflection value for all its polygons. In this case it is not necessary to use the Deflection function.
- Or an algorithm may want to attach a different deflection to each polygon. In this case, the Deflection function is used to set a value on each polygon, and later to fetch the value.
- Deflection(theDefl: number): void
Sets the deflection of this polygon.
Parameters (1)theDefl
- NbNodes(): number
Returns the number of nodes in this polygon. Note: If the polygon is closed, the point of closure is repeated at the end of its table of nodes. Thus, on a closed triangle, the function NbNodes returns 4.
Returns the table of nodes for this polygon.
Returns the table of nodes for this polygon.
Poly_Polygon3D
This class Provides a polygon in 3D space. It is generally an approximate representation of a curve. A Polygon3D is defined by a table of nodes. Each node is a 3D point. If the polygon is closed, the point of closure is repeated at the end of the table of nodes. If the polygon is an approximate representation of a curve, you can associate with each of its nodes the value of the parameter of the corresponding point on the curve.
Constructors(3)
Constructs a 3D polygon defined by the table of points, Nodes.
Parameters (1)Nodes
- constructor(theNbNodes: number, theHasParams: boolean): Poly_Polygon3D
Constructs a 3D polygon with specific number of nodes.
Parameters (2)theNbNodestheHasParams
- constructor(Nodes: NCollection_Array1_gp_Pnt, Parameters: NCollection_Array1_double): Poly_Polygon3D
Constructs a 3D polygon defined by the table of points, Nodes, and the parallel table of parameters, Parameters, where each value of the table Parameters is the parameter of the corresponding point on the curve approximated by the constructed polygon. Warning Both the Nodes and Parameters tables must have the same bounds. This property is not checked at construction time.
Parameters (2)NodesParameters
Static methods(2)
- get_type_name(): string
Instance methods(10)
Creates a copy of current polygon.
- Deflection(): number
Returns the deflection of this polygon.
- Deflection(theDefl: number): void
Sets the deflection of this polygon. See more on deflection in
Poly_Polygon2D.Parameters (1)theDefl
- NbNodes(): number
Returns the number of nodes in this polygon. Note: If the polygon is closed, the point of closure is repeated at the end of its table of nodes. Thus, on a closed triangle the function NbNodes returns 4.
Returns the table of nodes for this polygon.
Returns the table of nodes for this polygon.
- HasParameters(): boolean
Returns the table of the parameters associated with each node in this polygon. HasParameters function checks if parameters are associated with the nodes of this polygon.
Returns true if parameters are associated with the nodes in this polygon.
Returns the table of the parameters associated with each node in this polygon. ChangeParameters function returns the array as shared. Therefore if the table is selected by reference you can, by simply modifying it, directly modify the data structure of this polygon.
Poly_PolygonOnTriangulation
This class provides a polygon in 3D space, based on the triangulation of a surface. It may be the approximate representation of a curve on the surface, or more generally the shape. A PolygonOnTriangulation is defined by a table of nodes. Each node is an index in the table of nodes specific to a triangulation, and represents a point on the surface. If the polygon is closed, the index of the point of closure is repeated at the end of the table of nodes.
If the polygon is an approximate representation of a curve on a surface, you can associate with each of its nodes the value of the parameter of the corresponding point on the curve.represents a 3d Polygon.
Constructors(3)
Constructs a 3D polygon on the triangulation of a shape, defined by the table of nodes, <Nodes>.
Parameters (1)Nodes
- constructor(theNbNodes: number, theHasParams: boolean): Poly_PolygonOnTriangulation
Constructs a 3D polygon on the triangulation of a shape with specified size of nodes.
Parameters (2)theNbNodestheHasParams
- constructor(Nodes: NCollection_Array1_int, Parameters: NCollection_Array1_double): Poly_PolygonOnTriangulation
Constructs a 3D polygon on the triangulation of a shape, defined by:
- the table of nodes, Nodes, and the table of parameters, <Parameters>. where:
- a node value is an index in the table of nodes specific to an existing triangulation of a shape
- and a parameter value is the value of the parameter of the corresponding point on the curve approximated by the constructed polygon. Warning The tables Nodes and Parameters must be the same size. This property is not checked at construction time.
Parameters (2)NodesParameters
Static methods(2)
- get_type_name(): string
Instance methods(15)
Creates a copy of current polygon.
- Deflection(): number
Returns the deflection of this polygon.
- Deflection(theDefl: number): void
Sets the deflection of this polygon. See more on deflection in Poly_Polygones2D.
Parameters (1)theDefl
- NbNodes(): number
Returns the number of nodes for this polygon. Note: If the polygon is closed, the point of closure is repeated at the end of its table of nodes. Thus, on a closed triangle, the function NbNodes returns 4.
- Node(theIndex: number): number
Returns node at the given index.
Parameters (1)theIndex
- SetNode(theIndex: number, theNode: number): void
Sets node at the given index.
Parameters (2)theIndextheNode
- HasParameters(): boolean
Returns true if parameters are associated with the nodes in this polygon.
- Parameter(theIndex: number): number
Returns parameter at the given index.
Parameters (1)theIndex
- SetParameter(theIndex: number, theValue: number): void
Sets parameter at the given index.
Parameters (2)theIndextheValue
- SetParameters(theParameters: NCollection_HArray1_double): void
Sets the table of the parameters associated with each node in this polygon. Raises exception if array size doesn't much number of polygon nodes.
Parameters (1)theParameters
Returns the table of nodes for this polygon. A node value is an index in the table of nodes specific to an existing triangulation of a shape.
Returns the table of the parameters associated with each node in this polygon. Warning! Use the function HasParameters to check if parameters are associated with the nodes in this polygon.
- Deprecated
- Deprecated
Poly_Triangle
Describes a component triangle of a triangulation (Poly_Triangulation object). A Triangle is defined by a triplet of nodes within [1, Poly_Triangulation::NbNodes()] range. Each node is an index in the table of nodes specific to an existing triangulation of a shape, and represents a point on the surface.
Constructors(2)
Constructs a triangle and sets all indices to zero.
- constructor(theN1: number, theN2: number, theN3: number): Poly_Triangle
Constructs a triangle and sets its three indices, where these node values are indices in the table of nodes specific to an existing triangulation of a shape.
Parameters (3)theN1theN2theN3
Instance methods(5)
- Set(theN1: number, theN2: number, theN3: number): void
Sets the value of the three nodes of this triangle.
Parameters (3)theN1theN2theN3
- Set(theIndex: number, theNode: number): void
Sets the value of node with specified index of this triangle. Raises Standard_OutOfRange if index is not in 1,2,3.
Parameters (2)theIndextheNode
- Get(theN1: number, theN2: number, theN3: number): { theN1: number; theN2: number; theN3: number }
Returns the node indices of this triangle.
Parameters (3)theN1theN2theN3
ReturnsA result object with fields:
theN1: updated value from the call.theN2: updated value from the call.theN3: updated value from the call.
- Value(theIndex: number): number
Get the node of given Index. Raises OutOfRange from
Standardif Index is not in 1,2,3.Parameters (1)theIndex
- ChangeValue(theIndex: number): number
Get the node of given Index. Raises OutOfRange if Index is not in 1,2,3.
Parameters (1)theIndex
Poly_Triangulation
Provides a triangulation for a surface, a set of surfaces, or more generally a shape.
A triangulation consists of an approximate representation of the actual shape, using a collection of points and triangles. The points are located on the surface. The edges of the triangles connect adjacent points with a straight line that approximates the true curve on the surface.
A triangulation comprises:
- A table of 3D nodes (3D points on the surface).
- A table of triangles. Each triangle (
Poly_Triangleobject) comprises a triplet of indices in the table of 3D nodes specific to the triangulation. - An optional table of 2D nodes (2D points), parallel to the table of 3D nodes. 2D point are the (u, v) parameters of the corresponding 3D point on the surface approximated by the triangulation.
- An optional table of 3D vectors, parallel to the table of 3D nodes, defining normals to the surface at specified 3D point.
- An optional deflection, which maximizes the distance from a point on the surface to the corresponding point on its approximate triangulation.
In many cases, algorithms do not need to work with the exact representation of a surface. A triangular representation induces simpler and more robust adjusting, faster performances, and the results are as good.
Constructors(5)
Constructs an empty triangulation.
- constructor(theTriangulation: Poly_Triangulation): Poly_Triangulation
Copy constructor for triangulation.
Parameters (1)theTriangulation
- constructor(Nodes: NCollection_Array1_gp_Pnt, Triangles: NCollection_Array1_Poly_Triangle): Poly_Triangulation
Constructs a triangulation from a set of triangles. The triangulation is initialized with 3D points from Nodes and triangles from Triangles.
Parameters (2)NodesTriangles
- constructor(Nodes: NCollection_Array1_gp_Pnt, UVNodes: NCollection_Array1_gp_Pnt2d, Triangles: NCollection_Array1_Poly_Triangle): Poly_Triangulation
Constructs a triangulation from a set of triangles. The triangulation is initialized with 3D points from Nodes, 2D points from UVNodes and triangles from Triangles, where coordinates of a 2D point from UVNodes are the (u, v) parameters of the corresponding 3D point from Nodes on the surface approximated by the constructed triangulation.
Parameters (3)NodesUVNodesTriangles
- constructor(theNbNodes: number, theNbTriangles: number, theHasUVNodes: boolean, theHasNormals?: boolean): Poly_Triangulation
Constructs a triangulation from a set of triangles. The triangulation is initialized without a triangle or a node, but capable of containing specified number of nodes and triangles.
Parameters (4)theNbNodes—number of nodes to allocatetheNbTriangles—number of triangles to allocatetheHasUVNodes—indicates whether 2D nodes will be associated with 3D ones, (i.e. to enable a 2D representation)theHasNormals—indicates whether normals will be given and associated with nodes
Static methods(1)
Instance methods(52)
Creates full copy of current triangulation.
- Deflection(): number
Returns the deflection of this triangulation.
- Deflection(theDeflection: number): void
Sets the deflection of this triangulation to theDeflection. See more on deflection in Polygon2D.
Parameters (1)theDeflection
Returns initial set of parameters used to generate this triangulation.
- Parameters(theParams: Poly_TriangulationParameters): void
Updates initial set of parameters used to generate this triangulation.
Parameters (1)theParams
- Clear(): void
Clears internal arrays of nodes and all attributes.
- HasGeometry(): boolean
Returns TRUE if triangulation has some geometry.
- NbNodes(): number
Returns the number of nodes for this triangulation.
- NbTriangles(): number
Returns the number of triangles for this triangulation.
- HasUVNodes(): boolean
Returns true if 2D nodes are associated with 3D nodes for this triangulation.
- HasNormals(): boolean
Returns true if nodal normals are defined.
Returns a node at the given index.
Parameters (1)theIndex—node index within [1,NbNodes()] range
Returns3D point coordinates
Sets a node coordinates.
Parameters (2)theIndex—node index within [1,NbNodes()] rangethePnt—3D point coordinates
Returns UV-node at the given index.
Parameters (1)theIndex—node index within [1,NbNodes()] range
Returns2D point defining UV coordinates
Sets an UV-node coordinates.
Parameters (2)theIndex—node index within [1,NbNodes()] rangethePnt—UV coordinates
- Triangle(theIndex: number): Poly_Triangle
Returns triangle at the given index.
Parameters (1)theIndex—triangle index within [1,NbTriangles()] range
Returnstriangle node indices, with each node defined within [1,
NbNodes()] range - SetTriangle(theIndex: number, theTriangle: Poly_Triangle): void
Sets a triangle.
Parameters (2)theIndex—triangle index within [1,NbTriangles()] rangetheTriangle—triangle node indices, with each node defined within [1,NbNodes()] range
Returns normal at the given index.
Parameters (1)theIndex—node index within [1,NbNodes()] range
Returnsnormalized 3D vector defining a surface normal
Changes normal at the given index.
Parameters (2)theIndex—node index within [1,NbNodes()] rangetheNormal—normalized 3D vector defining a surface normal
- MeshPurpose(): number
Returns mesh purpose bits.
- SetMeshPurpose(thePurpose: number): void
Sets mesh purpose bits.
Parameters (1)thePurpose
Returns cached min - max range of triangulation data, which is VOID by default (e.g, no cached information).
- SetCachedMinMax(theBox: Bnd_Box): void
Sets a cached min - max range of this triangulation. The bounding box should exactly match actual range of triangulation data without a gap or transformation, or otherwise undefined behavior will be observed. Passing a VOID range invalidates the cache.
Parameters (1)theBox
- HasCachedMinMax(): boolean
Returns TRUE if there is some cached min - max range of this triangulation.
- UpdateCachedMinMax(): void
Updates cached min - max range of this triangulation with bounding box of nodal data.
Extends the passed box with bounding box of this triangulation. Uses cached min - max range when available and:
- input transformation theTrsf has no rotation part;
- theIsAccurate is set to FALSE;
- no triangulation data available (e.g. it is deferred and not loaded). out] theBox bounding box to extend by this triangulation
Parameters (3)theBox—Mutated in place; read the updated value from this argument after the call.theTrsf—optional transformationtheIsAccurate—when FALSE, allows using a cached min - max range of this triangulation even for non-identity transformation.
ReturnsFALSE if there is no any data to extend the passed box (no both triangulation and cached min - max range).
- IsDoublePrecision(): boolean
Returns TRUE if node positions are defined with double precision; TRUE by default.
- SetDoublePrecision(theIsDouble: boolean): void
Set if node positions should be defined with double or single precision for 3D and UV nodes. Raises exception if data was already allocated.
Parameters (1)theIsDouble
- ResizeNodes(theNbNodes: number, theToCopyOld: boolean): void
Method resizing internal arrays of nodes (synchronously for all attributes).
Parameters (2)theNbNodes—new number of nodestheToCopyOld—copy old nodes into the new array
- ResizeTriangles(theNbTriangles: number, theToCopyOld: boolean): void
Method resizing an internal array of triangles.
Parameters (2)theNbTriangles—new number of trianglestheToCopyOld—copy old triangles into the new array
- AddUVNodes(): void
If an array for UV coordinates is not allocated yet, do it now.
- RemoveUVNodes(): void
Deallocates the UV nodes array.
- AddNormals(): void
If an array for normals is not allocated yet, do it now.
- RemoveNormals(): void
Deallocates the normals array.
- ComputeNormals(): void
Compute smooth normals by averaging triangle normals.
Returns the table of 3D points for read-only access or NULL if nodes array is undefined.
Poly_Triangulation::Node()should be used instead when possible. Returned object should not be used afterPoly_Triangulationdestruction.Returns the triangle array for read-only access or NULL if triangle array is undefined.
Poly_Triangulation::Triangle()should be used instead when possible. Returned object should not be used afterPoly_Triangulationdestruction.Returns the table of 2D nodes for read-only access or NULL if UV nodes array is undefined.
Poly_Triangulation::UVNode()should be used instead when possible. Returned object should not be used afterPoly_Triangulationdestruction.Returns the table of per-vertex normals for read-only access or NULL if normals array is undefined.
Poly_Triangulation::Normal()should be used instead when possible. Returned object should not be used afterPoly_Triangulationdestruction.Returns an internal array of triangles.
Triangle()/SetTriangle() should be used instead in portable code.Returns an internal array of nodes.
Node()/SetNode() should be used instead in portable code.Returns an internal array of UV nodes. UBNode()/SetUVNode() should be used instead in portable code.
Return an internal array of normals.
Normal()/SetNormal() should be used instead in portable code.- SetNormals(theNormals: NCollection_HArray1_float): voidDeprecatedParameters (1)
theNormals
- Deprecated
- Deprecated
- ChangeTriangle(theIndex: number): Poly_TriangleDeprecatedParameters (1)
theIndex
- NbDeferredNodes(): number
- NbDeferredTriangles(): number
- HasDeferredData(): boolean
- UnloadDeferredData(): boolean
Poly_TriangulationParameters
Represents initial set of parameters triangulation is built for.
Constructors(1)
- constructor(theDeflection?: number, theAngle?: number, theMinSize?: number): Poly_TriangulationParameters
Constructor. Initializes object with the given parameters.
Parameters (3)theDeflection—linear deflectiontheAngle—angular deflectiontheMinSize—minimum size
Static methods(2)
- get_type_name(): string
Instance methods(7)
- HasDeflection(): boolean
Returns true if linear deflection is defined.
- HasAngle(): boolean
Returns true if angular deflection is defined.
- HasMinSize(): boolean
Returns true if minimum size is defined.
- Deflection(): number
Returns linear deflection or -1 if undefined.
- Angle(): number
Returns angular deflection or -1 if undefined.
- MinSize(): number
Returns minimum size or -1 if undefined.