mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-29 14:00:49 +03:00
0024002: Overall code and build procedure refactoring -- automatic
Automatic upgrade of OCCT code by command "occt_upgrade . -nocdl": - WOK-generated header files from inc and sources from drv are moved to src - CDL files removed - All packages are converted to nocdlpack
This commit is contained in:
@@ -1,15 +1,35 @@
|
||||
Poly_CoherentTriangulation.hxx
|
||||
Poly_CoherentTriangle.hxx
|
||||
Poly_CoherentTriPtr.hxx
|
||||
Poly_CoherentNode.hxx
|
||||
Poly_CoherentLink.hxx
|
||||
Poly_CoherentTriangulation.cxx
|
||||
Poly_CoherentTriangle.cxx
|
||||
Poly_CoherentTriPtr.cxx
|
||||
Poly_CoherentNode.cxx
|
||||
Poly_CoherentLink.cxx
|
||||
Poly_MakeLoops.hxx
|
||||
Poly_MakeLoops.cxx
|
||||
Poly_ListOfTriangulation.hxx
|
||||
Poly.cxx
|
||||
Poly.hxx
|
||||
Poly_Array1OfTriangle.hxx
|
||||
Poly_CoherentLink.cxx
|
||||
Poly_CoherentLink.hxx
|
||||
Poly_CoherentNode.cxx
|
||||
Poly_CoherentNode.hxx
|
||||
Poly_CoherentTriangle.cxx
|
||||
Poly_CoherentTriangle.hxx
|
||||
Poly_CoherentTriangulation.cxx
|
||||
Poly_CoherentTriangulation.hxx
|
||||
Poly_CoherentTriPtr.cxx
|
||||
Poly_CoherentTriPtr.hxx
|
||||
Poly_Connect.cxx
|
||||
Poly_Connect.hxx
|
||||
Poly_Connect.lxx
|
||||
Poly_HArray1OfTriangle.hxx
|
||||
Poly_ListOfTriangulation.hxx
|
||||
Poly_MakeLoops.cxx
|
||||
Poly_MakeLoops.hxx
|
||||
Poly_Polygon2D.cxx
|
||||
Poly_Polygon2D.hxx
|
||||
Poly_Polygon2D.lxx
|
||||
Poly_Polygon3D.cxx
|
||||
Poly_Polygon3D.hxx
|
||||
Poly_Polygon3D.lxx
|
||||
Poly_PolygonOnTriangulation.cxx
|
||||
Poly_PolygonOnTriangulation.hxx
|
||||
Poly_PolygonOnTriangulation.lxx
|
||||
Poly_Triangle.cxx
|
||||
Poly_Triangle.hxx
|
||||
Poly_Triangle.lxx
|
||||
Poly_Triangulation.cxx
|
||||
Poly_Triangulation.hxx
|
||||
Poly_Triangulation.lxx
|
||||
|
@@ -1,165 +0,0 @@
|
||||
-- Created on: 1995-03-06
|
||||
-- Created by: Laurent PAINNOT
|
||||
-- Copyright (c) 1995-1999 Matra Datavision
|
||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
--
|
||||
-- This file is part of Open CASCADE Technology software library.
|
||||
--
|
||||
-- This library is free software; you can redistribute it and/or modify it under
|
||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
-- by the Free Software Foundation, with special exception defined in the file
|
||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
||||
--
|
||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
||||
-- commercial license or contractual agreement.
|
||||
|
||||
package Poly
|
||||
|
||||
---Purpose: This package provides classes and services to
|
||||
-- handle :
|
||||
--
|
||||
-- * 3D triangular polyhedrons.
|
||||
--
|
||||
-- * 3D polygons.
|
||||
--
|
||||
-- * 2D polygon.
|
||||
--
|
||||
-- * Tools to dump, save and restore those objects.
|
||||
|
||||
uses
|
||||
|
||||
MMgt,
|
||||
TCollection,
|
||||
TColStd,
|
||||
gp,
|
||||
TColgp,
|
||||
TShort
|
||||
|
||||
is
|
||||
|
||||
class Triangle;
|
||||
|
||||
imported Array1OfTriangle;
|
||||
|
||||
imported transient class HArray1OfTriangle;
|
||||
|
||||
class Triangulation;
|
||||
|
||||
class Polygon3D;
|
||||
|
||||
class Polygon2D;
|
||||
|
||||
class PolygonOnTriangulation;
|
||||
|
||||
--
|
||||
-- Tools to use triangulations
|
||||
--
|
||||
|
||||
class Connect;
|
||||
---Purpose: Computes and stores the link from nodes to
|
||||
-- triangles and from triangles to neighbouring
|
||||
-- triangles.
|
||||
-- This tool is obsolete, replaced by Poly_CoherentTriangulation
|
||||
|
||||
--
|
||||
-- Data types for the Coherent Triangulation data model
|
||||
--
|
||||
imported CogerentTriangulation;
|
||||
imported CoherentTriangle;
|
||||
imported CoherentNode;
|
||||
imported CoherentLink;
|
||||
imported CoherentTriPtr;
|
||||
imported ListOfTriangulation;
|
||||
|
||||
imported MakeLoops;
|
||||
---Purpose: Algorithm to make minimal loops in a graph
|
||||
|
||||
--
|
||||
-- Package methods
|
||||
--
|
||||
|
||||
Catenate (lstTri: ListOfTriangulation from Poly)
|
||||
returns Triangulation from Poly;
|
||||
---Purpose: 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.
|
||||
|
||||
Write(T : Triangulation from Poly;
|
||||
OS : in out OStream;
|
||||
Compact : Boolean = Standard_True);
|
||||
|
||||
---Purpose: Writes the content of the triangulation <T> on the
|
||||
-- stream <OS>. If <Compact> is true this is a "save"
|
||||
-- format intended to be read back with the Read
|
||||
-- method. If compact is False it is a "Dump" format
|
||||
-- intended to be informative.
|
||||
|
||||
Write(P : Polygon3D from Poly;
|
||||
OS : in out OStream;
|
||||
Compact : Boolean = Standard_True);
|
||||
|
||||
---Purpose: Writes the content of the 3D polygon <P> on the
|
||||
-- stream <OS>. If <Compact> is true this is a "save"
|
||||
-- format intended to be read back with the Read
|
||||
-- method. If compact is False it is a "Dump" format
|
||||
-- intended to be informative.
|
||||
|
||||
Write(P : Polygon2D from Poly;
|
||||
OS : in out OStream;
|
||||
Compact : Boolean = Standard_True);
|
||||
|
||||
---Purpose: Writes the content of the 2D polygon <P> on the
|
||||
-- stream <OS>. If <Compact> is true this is a "save"
|
||||
-- format intended to be read back with the Read
|
||||
-- method. If compact is False it is a "Dump" format
|
||||
-- intended to be informative.
|
||||
|
||||
|
||||
Dump(T : Triangulation from Poly;
|
||||
OS : in out OStream);
|
||||
---Purpose: Dumps the triangulation. This is a call to the
|
||||
-- previous method with Comapct set to False.
|
||||
|
||||
Dump(P : Polygon3D from Poly;
|
||||
OS : in out OStream);
|
||||
---Purpose: Dumps the 3D polygon. This is a call to the
|
||||
-- previous method with Comapct set to False.
|
||||
|
||||
Dump(P : Polygon2D from Poly;
|
||||
OS : in out OStream);
|
||||
---Purpose: Dumps the 2D polygon. This is a call to the
|
||||
-- previous method with Comapct set to False.
|
||||
|
||||
|
||||
ReadTriangulation(IS : in out IStream)
|
||||
returns Triangulation from Poly;
|
||||
---Purpose: Reads a triangulation from the stream <IS>.
|
||||
|
||||
ReadPolygon3D(IS : in out IStream)
|
||||
returns Polygon3D from Poly;
|
||||
---Purpose: Reads a 3d polygon from the stream <IS>.
|
||||
|
||||
ReadPolygon2D(IS : in out IStream)
|
||||
returns Polygon2D from Poly;
|
||||
---Purpose: Reads a 2D polygon from the stream <IS>.
|
||||
|
||||
ComputeNormals(Tri : Triangulation from Poly);
|
||||
---Purpose: Compute node normals for face triangulation
|
||||
-- as mean normal of surrounding triangles
|
||||
|
||||
PointOnTriangle(P1, P2, P3, P: XY from gp; UV: out XY from gp)
|
||||
returns Real;
|
||||
---Purpose: 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).
|
||||
|
||||
end Poly;
|
@@ -14,20 +14,21 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <Standard_Stream.hxx>
|
||||
#include <Poly.ixx>
|
||||
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <Poly_Triangle.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <gp_XY.hxx>
|
||||
#include <Poly.hxx>
|
||||
#include <Poly_Array1OfTriangle.hxx>
|
||||
#include <Poly_ListOfTriangulation.hxx>
|
||||
|
||||
#include <Poly_Polygon3D.hxx>
|
||||
#include <Poly_Polygon2D.hxx>
|
||||
#include <Poly_Polygon3D.hxx>
|
||||
#include <Poly_Triangle.hxx>
|
||||
#include <Poly_Triangulation.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Standard_Stream.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <TShort_Array1OfShortReal.hxx>
|
||||
#include <TShort_HArray1OfShortReal.hxx>
|
||||
|
||||
@@ -35,7 +36,6 @@
|
||||
//function : Catenate
|
||||
//purpose : Join several triangulations to one new triangulation object
|
||||
//=======================================================================
|
||||
|
||||
Handle(Poly_Triangulation) Poly::Catenate (const Poly_ListOfTriangulation& lstTri)
|
||||
{
|
||||
Standard_Integer nNodes(0);
|
||||
|
156
src/Poly/Poly.hxx
Normal file
156
src/Poly/Poly.hxx
Normal file
@@ -0,0 +1,156 @@
|
||||
// Created on: 1995-03-06
|
||||
// Created by: Laurent PAINNOT
|
||||
// Copyright (c) 1995-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _Poly_HeaderFile
|
||||
#define _Poly_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Poly_ListOfTriangulation.hxx>
|
||||
#include <Standard_OStream.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_IStream.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
class Poly_Triangulation;
|
||||
class Poly_Polygon3D;
|
||||
class Poly_Polygon2D;
|
||||
class gp_XY;
|
||||
class Poly_Triangle;
|
||||
class Poly_Triangulation;
|
||||
class Poly_Polygon3D;
|
||||
class Poly_Polygon2D;
|
||||
class Poly_PolygonOnTriangulation;
|
||||
class Poly_Connect;
|
||||
|
||||
|
||||
//! This package provides classes and services to
|
||||
//! handle :
|
||||
//!
|
||||
//! * 3D triangular polyhedrons.
|
||||
//!
|
||||
//! * 3D polygons.
|
||||
//!
|
||||
//! * 2D polygon.
|
||||
//!
|
||||
//! * Tools to dump, save and restore those objects.
|
||||
class Poly
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! 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.
|
||||
Standard_EXPORT static Handle(Poly_Triangulation) Catenate (const Poly_ListOfTriangulation& lstTri);
|
||||
|
||||
//! Writes the content of the triangulation <T> on the
|
||||
//! stream <OS>. If <Compact> is true this is a "save"
|
||||
//! format intended to be read back with the Read
|
||||
//! method. If compact is False it is a "Dump" format
|
||||
//! intended to be informative.
|
||||
Standard_EXPORT static void Write (const Handle(Poly_Triangulation)& T, Standard_OStream& OS, const Standard_Boolean Compact = Standard_True);
|
||||
|
||||
//! Writes the content of the 3D polygon <P> on the
|
||||
//! stream <OS>. If <Compact> is true this is a "save"
|
||||
//! format intended to be read back with the Read
|
||||
//! method. If compact is False it is a "Dump" format
|
||||
//! intended to be informative.
|
||||
Standard_EXPORT static void Write (const Handle(Poly_Polygon3D)& P, Standard_OStream& OS, const Standard_Boolean Compact = Standard_True);
|
||||
|
||||
//! Writes the content of the 2D polygon <P> on the
|
||||
//! stream <OS>. If <Compact> is true this is a "save"
|
||||
//! format intended to be read back with the Read
|
||||
//! method. If compact is False it is a "Dump" format
|
||||
//! intended to be informative.
|
||||
Standard_EXPORT static void Write (const Handle(Poly_Polygon2D)& P, Standard_OStream& OS, const Standard_Boolean Compact = Standard_True);
|
||||
|
||||
//! Dumps the triangulation. This is a call to the
|
||||
//! previous method with Comapct set to False.
|
||||
Standard_EXPORT static void Dump (const Handle(Poly_Triangulation)& T, Standard_OStream& OS);
|
||||
|
||||
//! Dumps the 3D polygon. This is a call to the
|
||||
//! previous method with Comapct set to False.
|
||||
Standard_EXPORT static void Dump (const Handle(Poly_Polygon3D)& P, Standard_OStream& OS);
|
||||
|
||||
//! Dumps the 2D polygon. This is a call to the
|
||||
//! previous method with Comapct set to False.
|
||||
Standard_EXPORT static void Dump (const Handle(Poly_Polygon2D)& P, Standard_OStream& OS);
|
||||
|
||||
//! Reads a triangulation from the stream <IS>.
|
||||
Standard_EXPORT static Handle(Poly_Triangulation) ReadTriangulation (Standard_IStream& IS);
|
||||
|
||||
//! Reads a 3d polygon from the stream <IS>.
|
||||
Standard_EXPORT static Handle(Poly_Polygon3D) ReadPolygon3D (Standard_IStream& IS);
|
||||
|
||||
//! Reads a 2D polygon from the stream <IS>.
|
||||
Standard_EXPORT static Handle(Poly_Polygon2D) ReadPolygon2D (Standard_IStream& IS);
|
||||
|
||||
//! Compute node normals for face triangulation
|
||||
//! as mean normal of surrounding triangles
|
||||
Standard_EXPORT static void ComputeNormals (const Handle(Poly_Triangulation)& 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).
|
||||
Standard_EXPORT static Standard_Real PointOnTriangle (const gp_XY& P1, const gp_XY& P2, const gp_XY& P3, const gp_XY& P, gp_XY& UV);
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
friend class Poly_Triangle;
|
||||
friend class Poly_Triangulation;
|
||||
friend class Poly_Polygon3D;
|
||||
friend class Poly_Polygon2D;
|
||||
friend class Poly_PolygonOnTriangulation;
|
||||
friend class Poly_Connect;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _Poly_HeaderFile
|
@@ -1,142 +0,0 @@
|
||||
-- Created on: 1995-03-06
|
||||
-- Created by: Laurent PAINNOT
|
||||
-- Copyright (c) 1995-1999 Matra Datavision
|
||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
--
|
||||
-- This file is part of Open CASCADE Technology software library.
|
||||
--
|
||||
-- This library is free software; you can redistribute it and/or modify it under
|
||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
-- by the Free Software Foundation, with special exception defined in the file
|
||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
||||
--
|
||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
||||
-- commercial license or contractual agreement.
|
||||
|
||||
class Connect from Poly
|
||||
|
||||
---Purpose:
|
||||
-- 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.
|
||||
|
||||
uses
|
||||
|
||||
Array1OfInteger from TColStd,
|
||||
Triangulation from Poly
|
||||
|
||||
is
|
||||
|
||||
Create (T : Triangulation from Poly) returns Connect from Poly;
|
||||
---Purpose: Constructs an algorithm to explore the adjacency data of
|
||||
-- nodes or triangles for the triangulation T.
|
||||
|
||||
Triangulation(me) returns Triangulation from Poly;
|
||||
---Purpose: Returns the triangulation analyzed by this tool.
|
||||
---C++: inline
|
||||
|
||||
Triangle(me; N : Integer) returns Integer;
|
||||
---Purpose: Returns the index of a triangle containing the node at
|
||||
-- index N in the nodes table specific to the triangulation analyzed by this tool
|
||||
---C++: inline
|
||||
|
||||
Triangles(me; T: Integer; t1, t2, t3: out Integer);
|
||||
---Purpose: 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.
|
||||
|
||||
Nodes(me; T: Integer; n1, n2, n3: out Integer);
|
||||
---Purpose: 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.
|
||||
|
||||
Initialize(me: in out; N: Integer);
|
||||
---Purpose: 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();
|
||||
-- }
|
||||
|
||||
More(me) returns Boolean;
|
||||
---Purpose: 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).
|
||||
---C++: inline
|
||||
|
||||
|
||||
Next(me: in out)
|
||||
---Purpose: 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).-
|
||||
is static;
|
||||
|
||||
|
||||
Value(me) returns Integer;
|
||||
---Purpose: 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
|
||||
|
||||
|
||||
fields
|
||||
|
||||
myTriangulation : Triangulation from Poly;
|
||||
myTriangles : Array1OfInteger from TColStd;
|
||||
myAdjacents : Array1OfInteger from TColStd;
|
||||
mytr : Integer from Standard;
|
||||
myfirst : Integer from Standard;
|
||||
mynode : Integer from Standard;
|
||||
myothernode : Integer from Standard;
|
||||
mysense : Boolean from Standard;
|
||||
mymore : Boolean from Standard;
|
||||
|
||||
end Connect;
|
@@ -14,18 +14,17 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <Poly_Connect.ixx>
|
||||
|
||||
#include <Poly_Connect.hxx>
|
||||
#include <Poly_Triangle.hxx>
|
||||
|
||||
#include <Poly_Triangulation.hxx>
|
||||
#include <Standard.hxx>
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Poly_Connect
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
// this structure records one of the edges starting from a node
|
||||
|
||||
//typedef struct polyedge {
|
||||
struct polyedge {
|
||||
polyedge* next; // the next edge in the list
|
||||
|
166
src/Poly/Poly_Connect.hxx
Normal file
166
src/Poly/Poly_Connect.hxx
Normal file
@@ -0,0 +1,166 @@
|
||||
// Created on: 1995-03-06
|
||||
// Created by: Laurent PAINNOT
|
||||
// Copyright (c) 1995-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _Poly_Connect_HeaderFile
|
||||
#define _Poly_Connect_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
class Poly_Triangulation;
|
||||
|
||||
|
||||
|
||||
//! 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.
|
||||
class Poly_Connect
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Constructs an algorithm to explore the adjacency data of
|
||||
//! nodes or triangles for the triangulation T.
|
||||
Standard_EXPORT Poly_Connect(const Handle(Poly_Triangulation)& T);
|
||||
|
||||
//! Returns the triangulation analyzed by this tool.
|
||||
Handle(Poly_Triangulation) Triangulation() const;
|
||||
|
||||
//! Returns the index of a triangle containing the node at
|
||||
//! index N in the nodes table specific to the triangulation analyzed by this tool
|
||||
Standard_Integer Triangle (const Standard_Integer N) const;
|
||||
|
||||
//! 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.
|
||||
Standard_EXPORT void Triangles (const Standard_Integer T, Standard_Integer& t1, Standard_Integer& t2, Standard_Integer& t3) const;
|
||||
|
||||
//! 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.
|
||||
Standard_EXPORT void Nodes (const Standard_Integer T, Standard_Integer& n1, Standard_Integer& n2, Standard_Integer& n3) const;
|
||||
|
||||
//! 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();
|
||||
//! }
|
||||
Standard_EXPORT void Initialize (const Standard_Integer N);
|
||||
|
||||
//! 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).
|
||||
Standard_Boolean More() const;
|
||||
|
||||
//! 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).-
|
||||
Standard_EXPORT void Next();
|
||||
|
||||
//! 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
|
||||
Standard_EXPORT Standard_Integer Value() const;
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
Handle(Poly_Triangulation) myTriangulation;
|
||||
TColStd_Array1OfInteger myTriangles;
|
||||
TColStd_Array1OfInteger myAdjacents;
|
||||
Standard_Integer mytr;
|
||||
Standard_Integer myfirst;
|
||||
Standard_Integer mynode;
|
||||
Standard_Integer myothernode;
|
||||
Standard_Boolean mysense;
|
||||
Standard_Boolean mymore;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#include <Poly_Connect.lxx>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _Poly_Connect_HeaderFile
|
@@ -1,79 +0,0 @@
|
||||
-- Created on: 1995-03-09
|
||||
-- Created by: Laurent PAINNOT
|
||||
-- Copyright (c) 1995-1999 Matra Datavision
|
||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
--
|
||||
-- This file is part of Open CASCADE Technology software library.
|
||||
--
|
||||
-- This library is free software; you can redistribute it and/or modify it under
|
||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
-- by the Free Software Foundation, with special exception defined in the file
|
||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
||||
--
|
||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
||||
-- commercial license or contractual agreement.
|
||||
|
||||
class Polygon2D from Poly inherits TShared from MMgt
|
||||
|
||||
---Purpose: 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.
|
||||
|
||||
|
||||
uses Array1OfPnt2d from TColgp
|
||||
|
||||
raises NullObject from Standard
|
||||
|
||||
is
|
||||
|
||||
Create(Nodes: Array1OfPnt2d from TColgp)
|
||||
returns Polygon2D from Poly;
|
||||
---Purpose: Constructs a 2D polygon defined by the table of points, <Nodes>.
|
||||
|
||||
Deflection(me) returns Real;
|
||||
---Purpose: 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(me : mutable; D : Real);
|
||||
---Purpose: Sets the deflection of this polygon to D
|
||||
|
||||
NbNodes(me) returns Integer;
|
||||
---Purpose: 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.
|
||||
---C++: inline
|
||||
|
||||
Nodes(me) returns Array1OfPnt2d from TColgp
|
||||
---Purpose: Returns the table of nodes for this polygon.
|
||||
---C++: return const &
|
||||
raises NullObject from Standard;
|
||||
|
||||
|
||||
fields
|
||||
|
||||
myDeflection: Real;
|
||||
myNodes: Array1OfPnt2d from TColgp;
|
||||
|
||||
end Polygon2D;
|
@@ -14,14 +14,16 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <Poly_Polygon2D.ixx>
|
||||
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <Poly_Polygon2D.hxx>
|
||||
#include <Standard_NullObject.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : Poly_Polygon2D
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Poly_Polygon2D::Poly_Polygon2D(const TColgp_Array1OfPnt2d& Nodes):
|
||||
myDeflection(0.),
|
||||
myNodes(1, Nodes.Length())
|
||||
|
107
src/Poly/Poly_Polygon2D.hxx
Normal file
107
src/Poly/Poly_Polygon2D.hxx
Normal file
@@ -0,0 +1,107 @@
|
||||
// Created on: 1995-03-09
|
||||
// Created by: Laurent PAINNOT
|
||||
// Copyright (c) 1995-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _Poly_Polygon2D_HeaderFile
|
||||
#define _Poly_Polygon2D_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <Standard_Real.hxx>
|
||||
#include <TColgp_Array1OfPnt2d.hxx>
|
||||
#include <MMgt_TShared.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
class Standard_NullObject;
|
||||
|
||||
|
||||
class Poly_Polygon2D;
|
||||
DEFINE_STANDARD_HANDLE(Poly_Polygon2D, MMgt_TShared)
|
||||
|
||||
//! 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.
|
||||
class Poly_Polygon2D : public MMgt_TShared
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
//! Constructs a 2D polygon defined by the table of points, <Nodes>.
|
||||
Standard_EXPORT Poly_Polygon2D(const TColgp_Array1OfPnt2d& Nodes);
|
||||
|
||||
//! 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.
|
||||
Standard_EXPORT Standard_Real Deflection() const;
|
||||
|
||||
//! Sets the deflection of this polygon to D
|
||||
Standard_EXPORT void Deflection (const Standard_Real D);
|
||||
|
||||
//! 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.
|
||||
Standard_Integer NbNodes() const;
|
||||
|
||||
//! Returns the table of nodes for this polygon.
|
||||
Standard_EXPORT const TColgp_Array1OfPnt2d& Nodes() const;
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTI(Poly_Polygon2D,MMgt_TShared)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Standard_Real myDeflection;
|
||||
TColgp_Array1OfPnt2d myNodes;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#include <Poly_Polygon2D.lxx>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _Poly_Polygon2D_HeaderFile
|
@@ -1,95 +0,0 @@
|
||||
-- Created on: 1995-03-07
|
||||
-- Created by: Laurent PAINNOT
|
||||
-- Copyright (c) 1995-1999 Matra Datavision
|
||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
--
|
||||
-- This file is part of Open CASCADE Technology software library.
|
||||
--
|
||||
-- This library is free software; you can redistribute it and/or modify it under
|
||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
-- by the Free Software Foundation, with special exception defined in the file
|
||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
||||
--
|
||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
||||
-- commercial license or contractual agreement.
|
||||
|
||||
class Polygon3D from Poly inherits TShared from MMgt
|
||||
|
||||
---Purpose: 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.
|
||||
|
||||
uses Array1OfPnt from TColgp,
|
||||
Array1OfReal from TColStd,
|
||||
HArray1OfReal from TColStd
|
||||
|
||||
raises NullObject from Standard
|
||||
|
||||
is
|
||||
|
||||
Create(Nodes: Array1OfPnt from TColgp)
|
||||
returns Polygon3D from Poly;
|
||||
---Purpose: onstructs a 3D polygon defined by the table of points, Nodes.
|
||||
|
||||
Create(Nodes: Array1OfPnt from TColgp;
|
||||
Parameters: Array1OfReal from TColStd)
|
||||
returns Polygon3D from Poly;
|
||||
---Purpose: 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.
|
||||
|
||||
Deflection(me) returns Real;
|
||||
---Purpose: Returns the deflection of this polygon
|
||||
Deflection(me : mutable; D : Real);
|
||||
---Purpose: Sets the deflection of this polygon to D. See more on deflection in Poly_Polygon2D
|
||||
|
||||
NbNodes(me) returns Integer;
|
||||
---Purpose: 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.
|
||||
---C++: inline
|
||||
|
||||
Nodes(me) returns Array1OfPnt from TColgp
|
||||
---Purpose: Returns the table of nodes for this polygon.
|
||||
---C++: return const &
|
||||
raises NullObject from Standard;
|
||||
|
||||
|
||||
HasParameters(me) returns Boolean from Standard;
|
||||
---Purpose: 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.
|
||||
|
||||
Parameters(me) returns Array1OfReal from TColStd
|
||||
---Purpose: Returns true if parameters are associated with the nodes
|
||||
-- in this polygon.
|
||||
---C++: return const &
|
||||
raises NullObject from Standard;
|
||||
|
||||
ChangeParameters(me) returns Array1OfReal from TColStd
|
||||
---Purpose: Returns the table of the parameters associated with each node in this polygon.
|
||||
-- ChangeParameters function returnes 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.
|
||||
---C++: return &
|
||||
raises NullObject from Standard;
|
||||
|
||||
|
||||
|
||||
fields
|
||||
|
||||
myDeflection: Real from Standard;
|
||||
myNodes: Array1OfPnt from TColgp;
|
||||
myParameters: HArray1OfReal from TColStd;
|
||||
|
||||
end Polygon3D;
|
@@ -14,14 +14,16 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <Poly_Polygon3D.ixx>
|
||||
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <Poly_Polygon3D.hxx>
|
||||
#include <Standard_NullObject.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : Poly_Polygon3D
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Poly_Polygon3D::Poly_Polygon3D(const TColgp_Array1OfPnt& Nodes):
|
||||
myDeflection(0.),
|
||||
myNodes(1, Nodes.Length())
|
||||
|
118
src/Poly/Poly_Polygon3D.hxx
Normal file
118
src/Poly/Poly_Polygon3D.hxx
Normal file
@@ -0,0 +1,118 @@
|
||||
// Created on: 1995-03-07
|
||||
// Created by: Laurent PAINNOT
|
||||
// Copyright (c) 1995-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _Poly_Polygon3D_HeaderFile
|
||||
#define _Poly_Polygon3D_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <Standard_Real.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
#include <MMgt_TShared.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
class Standard_NullObject;
|
||||
|
||||
|
||||
class Poly_Polygon3D;
|
||||
DEFINE_STANDARD_HANDLE(Poly_Polygon3D, MMgt_TShared)
|
||||
|
||||
//! 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.
|
||||
class Poly_Polygon3D : public MMgt_TShared
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
//! onstructs a 3D polygon defined by the table of points, Nodes.
|
||||
Standard_EXPORT Poly_Polygon3D(const TColgp_Array1OfPnt& Nodes);
|
||||
|
||||
//! 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.
|
||||
Standard_EXPORT Poly_Polygon3D(const TColgp_Array1OfPnt& Nodes, const TColStd_Array1OfReal& Parameters);
|
||||
|
||||
//! Returns the deflection of this polygon
|
||||
Standard_EXPORT Standard_Real Deflection() const;
|
||||
|
||||
//! Sets the deflection of this polygon to D. See more on deflection in Poly_Polygon2D
|
||||
Standard_EXPORT void Deflection (const Standard_Real D);
|
||||
|
||||
//! 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.
|
||||
Standard_Integer NbNodes() const;
|
||||
|
||||
//! Returns the table of nodes for this polygon.
|
||||
Standard_EXPORT const TColgp_Array1OfPnt& Nodes() const;
|
||||
|
||||
//! 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.
|
||||
Standard_EXPORT Standard_Boolean HasParameters() const;
|
||||
|
||||
//! Returns true if parameters are associated with the nodes
|
||||
//! in this polygon.
|
||||
Standard_EXPORT const TColStd_Array1OfReal& Parameters() const;
|
||||
|
||||
//! Returns the table of the parameters associated with each node in this polygon.
|
||||
//! ChangeParameters function returnes 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.
|
||||
Standard_EXPORT TColStd_Array1OfReal& ChangeParameters() const;
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTI(Poly_Polygon3D,MMgt_TShared)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Standard_Real myDeflection;
|
||||
TColgp_Array1OfPnt myNodes;
|
||||
Handle(TColStd_HArray1OfReal) myParameters;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#include <Poly_Polygon3D.lxx>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _Poly_Polygon3D_HeaderFile
|
@@ -1,103 +0,0 @@
|
||||
-- Created on: 1996-02-21
|
||||
-- Created by: Laurent PAINNOT
|
||||
-- Copyright (c) 1996-1999 Matra Datavision
|
||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
--
|
||||
-- This file is part of Open CASCADE Technology software library.
|
||||
--
|
||||
-- This library is free software; you can redistribute it and/or modify it under
|
||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
-- by the Free Software Foundation, with special exception defined in the file
|
||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
||||
--
|
||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
||||
-- commercial license or contractual agreement.
|
||||
|
||||
class PolygonOnTriangulation from Poly inherits TShared from MMgt
|
||||
|
||||
---Purpose: 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
|
||||
|
||||
|
||||
uses Array1OfInteger from TColStd,
|
||||
Array1OfReal from TColStd,
|
||||
HArray1OfReal from TColStd,
|
||||
Triangulation from Poly
|
||||
|
||||
raises NullObject from Standard
|
||||
|
||||
is
|
||||
|
||||
Create(Nodes: Array1OfInteger from TColStd)
|
||||
returns PolygonOnTriangulation from Poly;
|
||||
---Purpose: Constructs a 3D polygon on the triangulation of a shape,
|
||||
-- defined by the table of nodes, <Nodes>.
|
||||
|
||||
Create(Nodes : Array1OfInteger from TColStd;
|
||||
Parameters: Array1OfReal from TColStd)
|
||||
returns PolygonOnTriangulation from Poly;
|
||||
---Purpose:
|
||||
-- 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.
|
||||
|
||||
Deflection(me) returns Real;
|
||||
---Purpose: Returns the deflection of this polygon
|
||||
Deflection(me : mutable; D : Real);
|
||||
---Purpose: Sets the deflection of this polygon to D.
|
||||
-- See more on deflection in Poly_Polygones2D.
|
||||
|
||||
NbNodes(me) returns Integer;
|
||||
---Purpose:
|
||||
-- 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.
|
||||
---C++: inline
|
||||
|
||||
Nodes(me) returns Array1OfInteger from TColStd
|
||||
---Purpose: 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.
|
||||
---C++: return const &
|
||||
raises NullObject from Standard;
|
||||
|
||||
|
||||
HasParameters(me) returns Boolean from Standard;
|
||||
---Purpose:
|
||||
-- Returns true if parameters are associated with the nodes in this polygon.
|
||||
Parameters(me) returns HArray1OfReal from TColStd
|
||||
--- Purpose: 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.
|
||||
--
|
||||
raises NullObject from Standard;
|
||||
|
||||
|
||||
fields
|
||||
|
||||
myDeflection : Real from Standard;
|
||||
myNodes : Array1OfInteger from TColStd;
|
||||
myParameters : HArray1OfReal from TColStd;
|
||||
|
||||
end PolygonOnTriangulation;
|
@@ -14,13 +14,15 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <Poly_PolygonOnTriangulation.ixx>
|
||||
|
||||
#include <Poly_PolygonOnTriangulation.hxx>
|
||||
#include <Standard_NullObject.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : Poly_PolygonOnTriangulation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Poly_PolygonOnTriangulation::Poly_PolygonOnTriangulation
|
||||
(const TColStd_Array1OfInteger& Nodes) :
|
||||
myDeflection(0.0),
|
||||
|
128
src/Poly/Poly_PolygonOnTriangulation.hxx
Normal file
128
src/Poly/Poly_PolygonOnTriangulation.hxx
Normal file
@@ -0,0 +1,128 @@
|
||||
// Created on: 1996-02-21
|
||||
// Created by: Laurent PAINNOT
|
||||
// Copyright (c) 1996-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _Poly_PolygonOnTriangulation_HeaderFile
|
||||
#define _Poly_PolygonOnTriangulation_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <Standard_Real.hxx>
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
#include <MMgt_TShared.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
class Standard_NullObject;
|
||||
|
||||
|
||||
class Poly_PolygonOnTriangulation;
|
||||
DEFINE_STANDARD_HANDLE(Poly_PolygonOnTriangulation, MMgt_TShared)
|
||||
|
||||
//! 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
|
||||
class Poly_PolygonOnTriangulation : public MMgt_TShared
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
//! Constructs a 3D polygon on the triangulation of a shape,
|
||||
//! defined by the table of nodes, <Nodes>.
|
||||
Standard_EXPORT Poly_PolygonOnTriangulation(const TColStd_Array1OfInteger& Nodes);
|
||||
|
||||
|
||||
//! 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.
|
||||
Standard_EXPORT Poly_PolygonOnTriangulation(const TColStd_Array1OfInteger& Nodes, const TColStd_Array1OfReal& Parameters);
|
||||
|
||||
//! Returns the deflection of this polygon
|
||||
Standard_EXPORT Standard_Real Deflection() const;
|
||||
|
||||
//! Sets the deflection of this polygon to D.
|
||||
//! See more on deflection in Poly_Polygones2D.
|
||||
Standard_EXPORT void Deflection (const Standard_Real D);
|
||||
|
||||
|
||||
//! 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.
|
||||
Standard_Integer NbNodes() const;
|
||||
|
||||
//! 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.
|
||||
Standard_EXPORT const TColStd_Array1OfInteger& Nodes() const;
|
||||
|
||||
|
||||
//! Returns true if parameters are associated with the nodes in this polygon.
|
||||
Standard_EXPORT Standard_Boolean HasParameters() const;
|
||||
|
||||
//! 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.
|
||||
Standard_EXPORT Handle(TColStd_HArray1OfReal) Parameters() const;
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTI(Poly_PolygonOnTriangulation,MMgt_TShared)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Standard_Real myDeflection;
|
||||
TColStd_Array1OfInteger myNodes;
|
||||
Handle(TColStd_HArray1OfReal) myParameters;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#include <Poly_PolygonOnTriangulation.lxx>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _Poly_PolygonOnTriangulation_HeaderFile
|
@@ -1,73 +0,0 @@
|
||||
-- Created on: 1995-03-06
|
||||
-- Created by: Laurent PAINNOT
|
||||
-- Copyright (c) 1995-1999 Matra Datavision
|
||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
--
|
||||
-- This file is part of Open CASCADE Technology software library.
|
||||
--
|
||||
-- This library is free software; you can redistribute it and/or modify it under
|
||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
-- by the Free Software Foundation, with special exception defined in the file
|
||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
||||
--
|
||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
||||
-- commercial license or contractual agreement.
|
||||
|
||||
class Triangle from Poly
|
||||
|
||||
---Purpose: Describes a component triangle of a triangulation
|
||||
-- (Poly_Triangulation object).
|
||||
-- A Triangle is defined by a triplet of nodes. 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.
|
||||
|
||||
raises
|
||||
OutOfRange from Standard
|
||||
|
||||
is
|
||||
|
||||
Create returns Triangle from Poly;
|
||||
---Purpose: Constructs a triangle and sets all indices to zero.
|
||||
|
||||
Create(N1,N2,N3 : Integer)
|
||||
returns Triangle from Poly;
|
||||
---Purpose: Constructs a triangle and sets its three indices
|
||||
-- to N1, N2 and N3 respectively, where these node values
|
||||
-- are indices in the table of nodes specific to an existing
|
||||
-- triangulation of a shape.
|
||||
Set(me : in out; N1,N2,N3 : Integer);
|
||||
---Purpose: Sets the value of the three nodes of this triangle to N1, N2 and N3 respectively.
|
||||
|
||||
Set(me : in out; Index, Node : Integer)
|
||||
---Purpose: Sets the value of the Indexth node of this triangle to Node.
|
||||
-- Raises OutOfRange if Index is not in 1,2,3
|
||||
raises
|
||||
OutOfRange from Standard;
|
||||
---C++: inline
|
||||
|
||||
Get(me; N1,N2,N3 : in out Integer);
|
||||
--- Purpose: Returns the node indices of this triangle in N1, N2 and N3.
|
||||
|
||||
Value(me; Index : Integer) returns Integer
|
||||
---Purpose: Get the node of given Index.
|
||||
-- Raises OutOfRange from Standard if Index is not in 1,2,3
|
||||
raises
|
||||
OutOfRange from Standard;
|
||||
---C++: inline
|
||||
---C++: alias operator()
|
||||
|
||||
ChangeValue(me : in out; Index : Integer) returns Integer
|
||||
---Purpose: Get the node of given Index.
|
||||
-- Raises OutOfRange if Index is not in 1,2,3
|
||||
raises
|
||||
OutOfRange from Standard;
|
||||
---C++: inline
|
||||
---C++: return &
|
||||
---C++: alias operator()
|
||||
|
||||
fields
|
||||
|
||||
myNodes : Integer [3];
|
||||
|
||||
end Triangle;
|
@@ -14,13 +14,14 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <Poly_Triangle.ixx>
|
||||
|
||||
#include <Poly_Triangle.hxx>
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : Poly_Triangle
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Poly_Triangle::Poly_Triangle()
|
||||
{
|
||||
myNodes[0] = myNodes[1] = myNodes[2] = 0;
|
||||
|
100
src/Poly/Poly_Triangle.hxx
Normal file
100
src/Poly/Poly_Triangle.hxx
Normal file
@@ -0,0 +1,100 @@
|
||||
// Created on: 1995-03-06
|
||||
// Created by: Laurent PAINNOT
|
||||
// Copyright (c) 1995-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _Poly_Triangle_HeaderFile
|
||||
#define _Poly_Triangle_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Standard_Integer.hxx>
|
||||
class Standard_OutOfRange;
|
||||
|
||||
|
||||
//! Describes a component triangle of a triangulation
|
||||
//! (Poly_Triangulation object).
|
||||
//! A Triangle is defined by a triplet of nodes. 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.
|
||||
class Poly_Triangle
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Constructs a triangle and sets all indices to zero.
|
||||
Standard_EXPORT Poly_Triangle();
|
||||
|
||||
//! Constructs a triangle and sets its three indices
|
||||
//! to N1, N2 and N3 respectively, where these node values
|
||||
//! are indices in the table of nodes specific to an existing
|
||||
//! triangulation of a shape.
|
||||
Standard_EXPORT Poly_Triangle(const Standard_Integer N1, const Standard_Integer N2, const Standard_Integer N3);
|
||||
|
||||
//! Sets the value of the three nodes of this triangle to N1, N2 and N3 respectively.
|
||||
Standard_EXPORT void Set (const Standard_Integer N1, const Standard_Integer N2, const Standard_Integer N3);
|
||||
|
||||
//! Sets the value of the Indexth node of this triangle to Node.
|
||||
//! Raises OutOfRange if Index is not in 1,2,3
|
||||
void Set (const Standard_Integer Index, const Standard_Integer Node);
|
||||
|
||||
//! Returns the node indices of this triangle in N1, N2 and N3.
|
||||
Standard_EXPORT void Get (Standard_Integer& N1, Standard_Integer& N2, Standard_Integer& N3) const;
|
||||
|
||||
//! Get the node of given Index.
|
||||
//! Raises OutOfRange from Standard if Index is not in 1,2,3
|
||||
Standard_Integer Value (const Standard_Integer Index) const;
|
||||
Standard_Integer operator() (const Standard_Integer Index) const
|
||||
{
|
||||
return Value(Index);
|
||||
}
|
||||
|
||||
//! Get the node of given Index.
|
||||
//! Raises OutOfRange if Index is not in 1,2,3
|
||||
Standard_Integer& ChangeValue (const Standard_Integer Index);
|
||||
Standard_Integer& operator() (const Standard_Integer Index)
|
||||
{
|
||||
return ChangeValue(Index);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
Standard_Integer myNodes[3];
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#include <Poly_Triangle.lxx>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _Poly_Triangle_HeaderFile
|
@@ -1,190 +0,0 @@
|
||||
-- Created on: 1995-03-06
|
||||
-- Created by: Laurent PAINNOT
|
||||
-- Copyright (c) 1995-1999 Matra Datavision
|
||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
--
|
||||
-- This file is part of Open CASCADE Technology software library.
|
||||
--
|
||||
-- This library is free software; you can redistribute it and/or modify it under
|
||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
-- by the Free Software Foundation, with special exception defined in the file
|
||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
||||
--
|
||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
||||
-- commercial license or contractual agreement.
|
||||
|
||||
class Triangulation from Poly inherits TShared from MMgt
|
||||
|
||||
---Purpose: 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.
|
||||
-- - A table of 2D nodes (2D points), parallel to the table of
|
||||
-- 3D nodes. This table is optional. If it exists, the
|
||||
-- coordinates of a 2D point are the (u, v) parameters
|
||||
-- of the corresponding 3D point on the surface
|
||||
-- approximated by the triangulation.
|
||||
-- - A deflection (optional), 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.
|
||||
-- This is a Transient class.
|
||||
|
||||
uses
|
||||
HArray1OfPnt2d from TColgp,
|
||||
Array1OfPnt from TColgp,
|
||||
Array1OfPnt2d from TColgp,
|
||||
Array1OfTriangle from Poly,
|
||||
HArray1OfShortReal from TShort,
|
||||
Array1OfShortReal from TShort
|
||||
|
||||
raises
|
||||
DomainError from Standard,
|
||||
NullObject from Standard
|
||||
|
||||
is
|
||||
|
||||
Create(nbNodes, nbTriangles: Integer; UVNodes: Boolean)
|
||||
returns Triangulation from Poly;
|
||||
---Purpose: Constructs a triangulation from a set of triangles. The
|
||||
-- triangulation is initialized without a triangle or a node, but capable of
|
||||
-- containing nbNodes nodes, and nbTriangles
|
||||
-- triangles. Here the UVNodes flag indicates whether
|
||||
-- 2D nodes will be associated with 3D ones, (i.e. to
|
||||
-- enable a 2D representation).
|
||||
|
||||
Create(Nodes: Array1OfPnt from TColgp;
|
||||
Triangles: Array1OfTriangle from Poly)
|
||||
returns Triangulation from Poly;
|
||||
---Purpose: Constructs a triangulation from a set of triangles. The
|
||||
-- triangulation is initialized with 3D points from Nodes and triangles
|
||||
-- from Triangles.
|
||||
|
||||
Create(Nodes: Array1OfPnt from TColgp;
|
||||
UVNodes: Array1OfPnt2d from TColgp;
|
||||
Triangles: Array1OfTriangle from Poly)
|
||||
returns Triangulation from Poly;
|
||||
---Purpose: 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.
|
||||
|
||||
Deflection(me) returns Real;
|
||||
---Purpose: Returns the deflection of this triangulation.
|
||||
Deflection(me : mutable; D : Real);
|
||||
---Purpose: Sets the deflection of this triangulation to D.
|
||||
-- See more on deflection in Polygon2D
|
||||
RemoveUVNodes(me : mutable);
|
||||
---Purpose: Deallocates the UV nodes.
|
||||
|
||||
NbNodes(me) returns Integer;
|
||||
---Purpose: Returns the number of nodes for this triangulation.
|
||||
-- Null if the nodes are not yet defined.
|
||||
---C++: inline
|
||||
|
||||
|
||||
NbTriangles(me) returns Integer;
|
||||
---Purpose: Returns the number of triangles for this triangulation.
|
||||
-- Null if the Triangles are not yet defined.
|
||||
---C++: inline
|
||||
|
||||
HasUVNodes(me) returns Boolean;
|
||||
---Purpose: Returns true if 2D nodes are associated with 3D nodes for
|
||||
-- this triangulation.
|
||||
---C++: inline
|
||||
|
||||
|
||||
Nodes(me) returns Array1OfPnt from TColgp
|
||||
---Purpose: Returns the table of 3D nodes (3D points) for this triangulation.
|
||||
---C++: return const &
|
||||
raises NullObject from Standard;
|
||||
|
||||
ChangeNodes(me : mutable) returns Array1OfPnt from TColgp
|
||||
---Purpose: Returns the table of 3D nodes (3D points) for this triangulation.
|
||||
-- The returned array is
|
||||
-- shared. Therefore if the table is selected by reference, you
|
||||
-- can, by simply modifying it, directly modify the data
|
||||
-- structure of this triangulation.
|
||||
---C++: return &
|
||||
raises NullObject from Standard;
|
||||
|
||||
UVNodes(me) returns Array1OfPnt2d from TColgp
|
||||
---Purpose: Returns the table of 2D nodes (2D points) associated with
|
||||
-- each 3D node of this triangulation.
|
||||
-- The function HasUVNodes checks if 2D nodes
|
||||
-- are associated with the 3D nodes of this triangulation.
|
||||
-- Const reference on the 2d nodes values.
|
||||
---C++: return const &
|
||||
raises NullObject from Standard;
|
||||
|
||||
ChangeUVNodes(me : mutable) returns Array1OfPnt2d from TColgp
|
||||
---Purpose: Returns the table of 2D nodes (2D points) associated with
|
||||
-- each 3D node of this triangulation.
|
||||
-- Function ChangeUVNodes shares the returned array.
|
||||
-- Therefore if the table is selected by reference,
|
||||
-- you can, by simply modifying it, directly modify the data
|
||||
-- structure of this triangulation.
|
||||
---C++: return &
|
||||
raises NullObject from Standard;
|
||||
|
||||
Triangles(me) returns Array1OfTriangle from Poly
|
||||
---Purpose: Returns the table of triangles for this triangulation.
|
||||
---C++: return const &
|
||||
raises NullObject from Standard;
|
||||
|
||||
ChangeTriangles(me : mutable) returns Array1OfTriangle from Poly
|
||||
---Purpose: Returns the table of triangles for this triangulation.
|
||||
-- Function ChangeUVNodes shares the returned array.
|
||||
-- Therefore if the table is selected by reference,
|
||||
-- you can, by simply modifying it, directly modify the data
|
||||
-- structure of this triangulation.
|
||||
---C++: return &
|
||||
raises NullObject from Standard;
|
||||
|
||||
SetNormals(me : mutable; theNormals : HArray1OfShortReal from TShort)
|
||||
---Purpose: Sets the table of node normals.
|
||||
-- raises exception if length of theNormals != 3*NbNodes
|
||||
raises DomainError from Standard;
|
||||
|
||||
Normals(me) returns Array1OfShortReal from TShort
|
||||
---C++: return const &
|
||||
-- raises exception if array of normals is empty or
|
||||
-- its length != 3*NbNodes
|
||||
raises NullObject from Standard;
|
||||
|
||||
ChangeNormals(me : mutable) returns Array1OfShortReal from TShort
|
||||
---C++: return &
|
||||
-- raises exception if array of normals is empty or
|
||||
-- its length != 3*NbNodes
|
||||
raises NullObject from Standard;
|
||||
|
||||
HasNormals(me) returns Boolean from Standard;
|
||||
|
||||
fields
|
||||
|
||||
myDeflection : Real;
|
||||
myNbNodes : Integer;
|
||||
myNbTriangles : Integer;
|
||||
myNodes : Array1OfPnt from TColgp;
|
||||
myUVNodes : HArray1OfPnt2d from TColgp;
|
||||
myTriangles : Array1OfTriangle from Poly;
|
||||
|
||||
---- Optional normals ---
|
||||
myNormals : HArray1OfShortReal from TShort;
|
||||
|
||||
end Triangulation;
|
@@ -14,16 +14,18 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <Poly_Triangulation.ixx>
|
||||
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <Poly_Triangle.hxx>
|
||||
|
||||
#include <Poly_Triangulation.hxx>
|
||||
#include <Standard_DomainError.hxx>
|
||||
#include <Standard_NullObject.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : Poly_Triangulation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Poly_Triangulation::Poly_Triangulation(const Standard_Integer NbNodes,
|
||||
const Standard_Integer NbTriangles,
|
||||
const Standard_Boolean UVNodes) :
|
||||
|
191
src/Poly/Poly_Triangulation.hxx
Normal file
191
src/Poly/Poly_Triangulation.hxx
Normal file
@@ -0,0 +1,191 @@
|
||||
// Created on: 1995-03-06
|
||||
// Created by: Laurent PAINNOT
|
||||
// Copyright (c) 1995-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _Poly_Triangulation_HeaderFile
|
||||
#define _Poly_Triangulation_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <TColgp_HArray1OfPnt2d.hxx>
|
||||
#include <Poly_Array1OfTriangle.hxx>
|
||||
#include <TShort_HArray1OfShortReal.hxx>
|
||||
#include <MMgt_TShared.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <TColgp_Array1OfPnt2d.hxx>
|
||||
#include <TShort_Array1OfShortReal.hxx>
|
||||
class Standard_DomainError;
|
||||
class Standard_NullObject;
|
||||
|
||||
|
||||
class Poly_Triangulation;
|
||||
DEFINE_STANDARD_HANDLE(Poly_Triangulation, MMgt_TShared)
|
||||
|
||||
//! 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.
|
||||
//! - A table of 2D nodes (2D points), parallel to the table of
|
||||
//! 3D nodes. This table is optional. If it exists, the
|
||||
//! coordinates of a 2D point are the (u, v) parameters
|
||||
//! of the corresponding 3D point on the surface
|
||||
//! approximated by the triangulation.
|
||||
//! - A deflection (optional), 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.
|
||||
//! This is a Transient class.
|
||||
class Poly_Triangulation : public MMgt_TShared
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
//! Constructs a triangulation from a set of triangles. The
|
||||
//! triangulation is initialized without a triangle or a node, but capable of
|
||||
//! containing nbNodes nodes, and nbTriangles
|
||||
//! triangles. Here the UVNodes flag indicates whether
|
||||
//! 2D nodes will be associated with 3D ones, (i.e. to
|
||||
//! enable a 2D representation).
|
||||
Standard_EXPORT Poly_Triangulation(const Standard_Integer nbNodes, const Standard_Integer nbTriangles, const Standard_Boolean UVNodes);
|
||||
|
||||
//! Constructs a triangulation from a set of triangles. The
|
||||
//! triangulation is initialized with 3D points from Nodes and triangles
|
||||
//! from Triangles.
|
||||
Standard_EXPORT Poly_Triangulation(const TColgp_Array1OfPnt& Nodes, const Poly_Array1OfTriangle& 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.
|
||||
Standard_EXPORT Poly_Triangulation(const TColgp_Array1OfPnt& Nodes, const TColgp_Array1OfPnt2d& UVNodes, const Poly_Array1OfTriangle& Triangles);
|
||||
|
||||
//! Returns the deflection of this triangulation.
|
||||
Standard_EXPORT Standard_Real Deflection() const;
|
||||
|
||||
//! Sets the deflection of this triangulation to D.
|
||||
//! See more on deflection in Polygon2D
|
||||
Standard_EXPORT void Deflection (const Standard_Real D);
|
||||
|
||||
//! Deallocates the UV nodes.
|
||||
Standard_EXPORT void RemoveUVNodes();
|
||||
|
||||
//! Returns the number of nodes for this triangulation.
|
||||
//! Null if the nodes are not yet defined.
|
||||
Standard_Integer NbNodes() const;
|
||||
|
||||
//! Returns the number of triangles for this triangulation.
|
||||
//! Null if the Triangles are not yet defined.
|
||||
Standard_Integer NbTriangles() const;
|
||||
|
||||
//! Returns true if 2D nodes are associated with 3D nodes for
|
||||
//! this triangulation.
|
||||
Standard_Boolean HasUVNodes() const;
|
||||
|
||||
//! Returns the table of 3D nodes (3D points) for this triangulation.
|
||||
Standard_EXPORT const TColgp_Array1OfPnt& Nodes() const;
|
||||
|
||||
//! Returns the table of 3D nodes (3D points) for this triangulation.
|
||||
//! The returned array is
|
||||
//! shared. Therefore if the table is selected by reference, you
|
||||
//! can, by simply modifying it, directly modify the data
|
||||
//! structure of this triangulation.
|
||||
Standard_EXPORT TColgp_Array1OfPnt& ChangeNodes();
|
||||
|
||||
//! Returns the table of 2D nodes (2D points) associated with
|
||||
//! each 3D node of this triangulation.
|
||||
//! The function HasUVNodes checks if 2D nodes
|
||||
//! are associated with the 3D nodes of this triangulation.
|
||||
//! Const reference on the 2d nodes values.
|
||||
Standard_EXPORT const TColgp_Array1OfPnt2d& UVNodes() const;
|
||||
|
||||
//! Returns the table of 2D nodes (2D points) associated with
|
||||
//! each 3D node of this triangulation.
|
||||
//! Function ChangeUVNodes shares the returned array.
|
||||
//! Therefore if the table is selected by reference,
|
||||
//! you can, by simply modifying it, directly modify the data
|
||||
//! structure of this triangulation.
|
||||
Standard_EXPORT TColgp_Array1OfPnt2d& ChangeUVNodes();
|
||||
|
||||
//! Returns the table of triangles for this triangulation.
|
||||
Standard_EXPORT const Poly_Array1OfTriangle& Triangles() const;
|
||||
|
||||
//! Returns the table of triangles for this triangulation.
|
||||
//! Function ChangeUVNodes shares the returned array.
|
||||
//! Therefore if the table is selected by reference,
|
||||
//! you can, by simply modifying it, directly modify the data
|
||||
//! structure of this triangulation.
|
||||
Standard_EXPORT Poly_Array1OfTriangle& ChangeTriangles();
|
||||
|
||||
//! Sets the table of node normals.
|
||||
//! raises exception if length of theNormals != 3*NbNodes
|
||||
Standard_EXPORT void SetNormals (const Handle(TShort_HArray1OfShortReal)& theNormals);
|
||||
|
||||
Standard_EXPORT const TShort_Array1OfShortReal& Normals() const;
|
||||
|
||||
Standard_EXPORT TShort_Array1OfShortReal& ChangeNormals();
|
||||
|
||||
Standard_EXPORT Standard_Boolean HasNormals() const;
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTI(Poly_Triangulation,MMgt_TShared)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Standard_Real myDeflection;
|
||||
Standard_Integer myNbNodes;
|
||||
Standard_Integer myNbTriangles;
|
||||
TColgp_Array1OfPnt myNodes;
|
||||
Handle(TColgp_HArray1OfPnt2d) myUVNodes;
|
||||
Poly_Array1OfTriangle myTriangles;
|
||||
Handle(TShort_HArray1OfShortReal) myNormals;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#include <Poly_Triangulation.lxx>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _Poly_Triangulation_HeaderFile
|
Reference in New Issue
Block a user