OpenCascade.js
API ReferenceFoundationClassesTKMath

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)

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_CoherentTriangulation Algorithm 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
  • Compute node normals for face triangulation as mean normal of surrounding triangles.

    Parameters (1)
    • Tri
  • PointOnTriangle(P1: gp_XY, P2: gp_XY, P3: gp_XY, P: gp_XY, UV: gp_XY): number

    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)
    • P1
    • P2
    • P3
    • P
    • UV
      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 triangulation
    • theAxis
      intersecting ray
    • theIsClosest
      finds the closest intersection when TRUE, finds the farthest otherwise
    • theTriangle
      intersected triangle Mutated in place; read the updated value from this argument after the call.
    • theDistance
      distance along ray to intersection point
    Returns

    A 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 origin
    • theDir
      picking ray direction
    • theV0
      first triangle node
    • theV1
      second triangle node
    • theV2
      third triangle node
    • theParam
      param on line of the intersection point
    Returns

    A 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)

Instance methods(6)

  • 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
  • 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 assignment.

    Parameters (1)
    • theOther
      Mutated in place; read the updated value from this argument after the call.
  • Value(theIndex: number): gp_Pnt

    A generalized accessor to point.

    Parameters (1)
    • theIndex
  • SetValue(theIndex: number, theValue: gp_Pnt): void

    A generalized setter for point.

    Parameters (2)
    • theIndex
    • theValue

Poly_ArrayOfUVNodes

Defines an array of 2D nodes of single/double precision configurable at construction time.

Constructors(4)

Instance methods(6)

  • 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
  • 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 assignment.

    Parameters (1)
    • theOther
      Mutated in place; read the updated value from this argument after the call.
  • Value(theIndex: number): gp_Pnt2d

    A generalized accessor to point.

    Parameters (1)
    • theIndex
  • SetValue(theIndex: number, theValue: gp_Pnt2d): void

    A generalized setter for point.

    Parameters (2)
    • theIndex
    • theValue

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)

Instance methods(12)

Poly_CoherentTriangle

Data class used in Poly_CoherentTriangultion. Implements a triangle with references to its neighbours.

Constructors(2)

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.
    Returns

    True if successful, False if the connection is rejected due to improper topology.

  • 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.
    Returns

    True 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).
  • Remove the connection with the given Triangle.

    Parameters (1)
    • theTri
      Mutated in place; read the updated value from this argument after the call.
    Returns

    True 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
  • Query the connected triangle on the given side. Returns NULL if there is no connection on the specified side.

    Parameters (1)
    • iConn
  • 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_Triangulation structure.
    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 of gp_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 in Poly_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 temporary Poly_CoherentLink and calling the method FindTriangle(). 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 method ComputeLinks(). Each Link is oriented couple of Poly_CoherentNode (directed to the ascending Node index).
    It refers two connected triangulated Nodes - on the left and on the right, therefore a Poly_CoherentLink instance 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 method AddTriangle() and existing ones are removed by method RemoveTriangle(), in each case whenever necessary.
    Similarly to Poly_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 method ClearLinks(), 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 corresponding Iterator. 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 subclass Poly_CoherentTriangulation and use the protected API for your needs.
    Memory management: All data objects are stored in NCollection_DynamicArray containers that prove to be efficient for the performance.
    In addition references to triangles are stored in ring lists, with an instance of such list per Poly_CoherentNode.
    These lists are allocated in a memory allocator that is provided in the constructor of Poly_CoherentTriangulation. By default the standard OCCT allocator (aka NCollection_BaseAllocator) is used.
    But if you need to increase the performance you can use NCollection_IncAllocator instead.

Constructors(2)

Static methods(2)

Instance methods(25)

  • Create an instance of Poly_Triangulation from 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.
  • 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)

  • SetNode(thePnt: gp_XYZ, iN?: number): number

    Initialize a node

    Parameters (2)
    • thePnt
    • iN
      Index of the node. If negative (default), the node is added to the end of the current array of nodes.
    Returns

    Index of the added node.

  • Get the node at the given index 'i'.

    Parameters (1)
    • i
  • 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)

  • 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)

  • Removal of a single triangle from the triangulation.

    Parameters (1)
    • theTr
      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)
    • iNode0
    • iNode1
    • iNode2
    Returns

    Pointer 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.
    • iNode0
    • iNode1
    • iNode2
    Returns

    True if operation succeeded.

  • 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.
    Returns

    True if at least one triangle is found and output as pTri.

  • Query the allocator of elements, this allocator can be used for other objects

  • Create a copy of this Triangulation, using the given allocator.

    Parameters (1)
    • theAlloc

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)

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)
    • T
    • t1
    • t2
    • t3
    Returns

    A 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)
    • T
    • n1
    • n2
    • n3
    Returns

    A 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_Connect C(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)

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 angle
    • theMergeTolerance
      node merging maximum distance
    • theNbFacets
      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 add
    • theTrsf
      transformation to apply
    • theToReverse
      reverse triangle nodes order
    • theSmoothAngle
      merge angle in radians
    • theMergeTolerance
      linear merge tolerance
    • theToForce
      return merged triangulation even if it's statistics is equal to input one
    Returns

    merged 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
  • 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 add
    • theTrsf
      transformation to apply
    • theToReverse
      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
  • AddQuad(theElemNodes: [gp_XYZ, gp_XYZ, gp_XYZ, gp_XYZ]): void

    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 nodes
    • theNbNodes
      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
  • 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.

  • 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)

Static methods(2)

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)
    • theNbNodes
    • theHasParams
  • 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)
    • Nodes
    • Parameters

Static methods(2)

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)
    • theNbNodes
    • theHasParams
  • 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)
    • Nodes
    • Parameters

Static methods(2)

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)
    • theIndex
    • theNode
  • 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)
    • theIndex
    • theValue
  • 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)
    • theN1
    • theN2
    • theN3

Instance methods(5)

  • Set(theN1: number, theN2: number, theN3: number): void

    Sets the value of the three nodes of this triangle.

    Parameters (3)
    • theN1
    • theN2
    • theN3
  • 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)
    • theIndex
    • theNode
  • Get(theN1: number, theN2: number, theN3: number): { theN1: number; theN2: number; theN3: number }

    Returns the node indices of this triangle.

    Parameters (3)
    • theN1
    • theN2
    • theN3
    Returns

    A 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 Standard if 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_Triangle object) 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.

  • Copy constructor for triangulation.

    Parameters (1)
    • theTriangulation
  • Constructs a triangulation from a set of triangles. The triangulation is initialized with 3D points from Nodes and triangles from Triangles.

    Parameters (2)
    • Nodes
    • Triangles
  • 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)
    • Nodes
    • UVNodes
    • Triangles
  • 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 allocate
    • theNbTriangles
      number of triangles to allocate
    • theHasUVNodes
      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.

  • 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.

  • Node(theIndex: number): gp_Pnt

    Returns a node at the given index.

    Parameters (1)
    • theIndex
      node index within [1, NbNodes()] range
    Returns

    3D point coordinates

  • SetNode(theIndex: number, thePnt: gp_Pnt): void

    Sets a node coordinates.

    Parameters (2)
    • theIndex
      node index within [1, NbNodes()] range
    • thePnt
      3D point coordinates
  • UVNode(theIndex: number): gp_Pnt2d

    Returns UV-node at the given index.

    Parameters (1)
    • theIndex
      node index within [1, NbNodes()] range
    Returns

    2D point defining UV coordinates

  • SetUVNode(theIndex: number, thePnt: gp_Pnt2d): void

    Sets an UV-node coordinates.

    Parameters (2)
    • theIndex
      node index within [1, NbNodes()] range
    • thePnt
      UV coordinates
  • Triangle(theIndex: number): Poly_Triangle

    Returns triangle at the given index.

    Parameters (1)
    • theIndex
      triangle index within [1, NbTriangles()] range
    Returns

    triangle 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()] range
    • theTriangle
      triangle node indices, with each node defined within [1, NbNodes()] range
  • Normal(theIndex: number): gp_Dir

    Returns normal at the given index.

    Parameters (1)
    • theIndex
      node index within [1, NbNodes()] range
    Returns

    normalized 3D vector defining a surface normal

  • SetNormal(theIndex: number, theNormal: gp_Dir): void

    Changes normal at the given index.

    Parameters (2)
    • theIndex
      node index within [1, NbNodes()] range
    • theNormal
      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.

  • Updates cached min - max range of this triangulation with bounding box of nodal data.

  • MinMax(theBox: Bnd_Box, theTrsf: gp_Trsf, theIsAccurate: boolean): boolean

    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 transformation
    • theIsAccurate
      when FALSE, allows using a cached min - max range of this triangulation even for non-identity transformation.
    Returns

    FALSE if there is no any data to extend the passed box (no both triangulation and cached min - max range).

  • 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 nodes
    • theToCopyOld
      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 triangles
    • theToCopyOld
      copy old triangles into the new array
  • AddUVNodes(): void

    If an array for UV coordinates is not allocated yet, do it now.

  • Deallocates the UV nodes array.

  • AddNormals(): void

    If an array for normals is not allocated yet, do it now.

  • Deallocates the normals array.

  • 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 after Poly_Triangulation destruction.

  • 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 after Poly_Triangulation destruction.

  • 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 after Poly_Triangulation destruction.

  • 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 after Poly_Triangulation destruction.

  • 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.

  • Deprecated
    Parameters (1)
    • theNormals
  • Deprecated
  • Deprecated
  • ChangeTriangle(theIndex: number): Poly_Triangle
    Deprecated
    Parameters (1)
    • theIndex
  • NbDeferredNodes(): number
  • HasDeferredData(): 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 deflection
    • theAngle
      angular deflection
    • theMinSize
      minimum size

Static methods(2)

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.