mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
Integration of OCCT 6.5.0 from SVN
This commit is contained in:
65
src/StlMesh/StlMesh.cdl
Executable file
65
src/StlMesh/StlMesh.cdl
Executable file
@@ -0,0 +1,65 @@
|
||||
-- File: StlMesh.cdl
|
||||
-- Created: Tues Sep 21 09:31:42 1995
|
||||
-- Author: Philippe GIRODENGO
|
||||
---Copyright: Matra Datavision 1995
|
||||
|
||||
|
||||
package StlMesh
|
||||
|
||||
---Purpose: Implements a basic mesh data-structure for the
|
||||
-- needs of the application fast prototyping.
|
||||
--
|
||||
|
||||
uses
|
||||
|
||||
MMgt,
|
||||
TCollection,
|
||||
TColStd,
|
||||
gp,
|
||||
TColgp
|
||||
|
||||
is
|
||||
|
||||
class Mesh;
|
||||
---Purpose: Mesh definition. The mesh contains one or several
|
||||
-- domains. Each mesh domain contains a set of
|
||||
-- triangles. Each domain can have its own deflection
|
||||
-- value.
|
||||
|
||||
|
||||
class MeshExplorer;
|
||||
---Purpose: Provides facilities to explore the triangles of
|
||||
-- each mesh domain.
|
||||
|
||||
|
||||
class MeshDomain;
|
||||
---Purpose: Set of triangles defined with three vertices and a
|
||||
-- given orientation. Internal class used to classify
|
||||
-- the triangles of each domain.
|
||||
|
||||
|
||||
class MeshTriangle;
|
||||
---Purpose: triangle defined with three vertices and a given
|
||||
-- orientation
|
||||
|
||||
|
||||
|
||||
class SequenceOfMeshDomain instantiates
|
||||
Sequence from TCollection (MeshDomain from StlMesh);
|
||||
|
||||
|
||||
|
||||
class SequenceOfMeshTriangle instantiates
|
||||
Sequence from TCollection (MeshTriangle from StlMesh);
|
||||
|
||||
|
||||
class SequenceOfMesh instantiates
|
||||
Sequence from TCollection (Mesh from StlMesh);
|
||||
---Purpose: Sequence of meshes
|
||||
|
||||
Merge (mesh1, mesh2 : in Mesh) returns Mesh;
|
||||
---Purpose: Make a merge of two Mesh and returns a new Mesh.
|
||||
-- Very useful if you want to merge partMesh and CheckSurfaceMesh
|
||||
-- for example
|
||||
|
||||
end StlMesh;
|
66
src/StlMesh/StlMesh.cxx
Executable file
66
src/StlMesh/StlMesh.cxx
Executable file
@@ -0,0 +1,66 @@
|
||||
// File: StlMesh.cxx
|
||||
// Created: Fri Jun 21 15:48:55 1996
|
||||
// Author: Bruno TACCI
|
||||
// <bti@sgi44>
|
||||
|
||||
#include <StlMesh.ixx>
|
||||
#include <StlMesh_SequenceOfMeshTriangle.hxx>
|
||||
#include <StlMesh_MeshTriangle.hxx>
|
||||
#include <TColgp_SequenceOfXYZ.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : Merge
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(StlMesh_Mesh) StlMesh::Merge(const Handle(StlMesh_Mesh)& mesh1, const Handle(StlMesh_Mesh)& mesh2)
|
||||
{
|
||||
Handle(StlMesh_Mesh) mergeMesh = new StlMesh_Mesh;
|
||||
StlMesh_SequenceOfMeshTriangle aSeqOfTriangle;
|
||||
TColgp_SequenceOfXYZ aSeqOfVertex;
|
||||
Standard_Real xn,yn,zn;
|
||||
Standard_Integer v1,v2,v3;
|
||||
|
||||
// Chargement de mesh1 dans mergeMesh
|
||||
// Boucle sur les domaines puis sur les triangles
|
||||
|
||||
Standard_Integer idom;
|
||||
for (idom = 1; idom <= mesh1->NbDomains(); idom++) {
|
||||
aSeqOfTriangle = mesh1->Triangles(idom);
|
||||
aSeqOfVertex = mesh1->Vertices(idom);
|
||||
mergeMesh->AddDomain(mesh1->Deflection(idom));
|
||||
|
||||
for (Standard_Integer itri = 1; itri <= mesh1->NbTriangles(idom); itri++) {
|
||||
const Handle(StlMesh_MeshTriangle) aTrian = aSeqOfTriangle.Value(itri);
|
||||
aTrian->GetVertexAndOrientation(v1,v2,v3,xn,yn,zn);
|
||||
mergeMesh->AddTriangle(v1,v2,v3,xn,yn,zn);
|
||||
}
|
||||
|
||||
for (Standard_Integer iver = 1; iver <= mesh1->NbVertices(idom); iver++) {
|
||||
mergeMesh->AddVertex(aSeqOfVertex.Value(iver).X(),
|
||||
aSeqOfVertex.Value(iver).Y(),
|
||||
aSeqOfVertex.Value(iver).Z());
|
||||
}
|
||||
|
||||
}
|
||||
// Idem avec mesh2
|
||||
|
||||
for (idom = 1; idom <= mesh2->NbDomains(); idom++) {
|
||||
aSeqOfTriangle = mesh2->Triangles(idom);
|
||||
aSeqOfVertex = mesh2->Vertices(idom);
|
||||
mergeMesh->AddDomain(mesh2->Deflection(idom));
|
||||
|
||||
for (Standard_Integer itri = 1; itri <= mesh2->NbTriangles(idom); itri++) {
|
||||
const Handle(StlMesh_MeshTriangle) aTrian = aSeqOfTriangle.Value(itri);
|
||||
aTrian->GetVertexAndOrientation(v1,v2,v3,xn,yn,zn);
|
||||
mergeMesh->AddTriangle(v1,v2,v3,xn,yn,zn);
|
||||
}
|
||||
|
||||
for (Standard_Integer iver = 1; iver <= mesh2->NbVertices(idom); iver++) {
|
||||
mergeMesh->AddVertex(aSeqOfVertex.Value(iver).X(),
|
||||
aSeqOfVertex.Value(iver).Y(),
|
||||
aSeqOfVertex.Value(iver).Z());
|
||||
}
|
||||
}
|
||||
return mergeMesh;
|
||||
}
|
159
src/StlMesh/StlMesh_Mesh.cdl
Executable file
159
src/StlMesh/StlMesh_Mesh.cdl
Executable file
@@ -0,0 +1,159 @@
|
||||
-- File: StlMesh_Mesh.cdl
|
||||
-- Created: Tue Sep 21 09:49:25 1995
|
||||
-- Author: Philippe GIRODENGO
|
||||
---Copyright: Matra Datavision 1995
|
||||
|
||||
|
||||
|
||||
class Mesh from StlMesh inherits TShared from MMgt
|
||||
|
||||
|
||||
---Purpose: Mesh definition. The mesh contains one or several
|
||||
-- domains. Each mesh domain contains a set of
|
||||
-- triangles. Each domain can have its own deflection
|
||||
-- value.
|
||||
--
|
||||
uses
|
||||
|
||||
XYZ from gp,
|
||||
SequenceOfMeshDomain from StlMesh,
|
||||
SequenceOfMeshTriangle from StlMesh,
|
||||
SequenceOfXYZ from TColgp
|
||||
|
||||
raises
|
||||
|
||||
NegativeValue from Standard,
|
||||
NullValue from Standard,
|
||||
NoSuchObject from Standard
|
||||
|
||||
is
|
||||
|
||||
Create returns mutable Mesh;
|
||||
---Purpose: Creates an empty mesh.
|
||||
|
||||
|
||||
AddDomain (me : mutable) is virtual;
|
||||
---Purpose: Adds a new mesh domain. The mesh deflection is
|
||||
-- defaulted to Confusion from package Precision.
|
||||
|
||||
|
||||
AddDomain (me : mutable; Deflection : Real)
|
||||
---Purpose: Adds a new mesh domain.
|
||||
raises NegativeValue,
|
||||
---Purpose: Raised if the deflection is lower than zero
|
||||
NullValue
|
||||
---Purpose: Raised if the deflection is lower than Confusion
|
||||
-- from package Precision
|
||||
is virtual;
|
||||
|
||||
|
||||
AddTriangle (me : mutable; V1, V2, V3 : Integer; Xn, Yn, Zn : Real)
|
||||
returns Integer
|
||||
---Purpose: Build a triangle with the triplet of vertices (V1,
|
||||
-- V2, V3). This triplet defines the indexes of the
|
||||
-- vertex in the current domain The coordinates Xn,
|
||||
-- Yn, Zn defines the normal direction to the
|
||||
-- triangle. Returns the range of the triangle in
|
||||
-- the current domain.
|
||||
is virtual;
|
||||
|
||||
|
||||
AddVertex (me : mutable; X, Y, Z : Real) returns Integer is virtual;
|
||||
---Purpose: Returns the range of the vertex in the current
|
||||
-- domain.
|
||||
|
||||
|
||||
AddOnlyNewVertex (me : mutable; X, Y, Z : Real) returns Integer
|
||||
---Purpose: Returns the range of the vertex in the current
|
||||
-- domain. The current vertex is not inserted in the
|
||||
-- mesh if it already exist.
|
||||
is virtual;
|
||||
|
||||
|
||||
Bounds (me; XYZmax, XYZmin : in out XYZ) is virtual;
|
||||
---Purpose: Each vertex of the mesh verifies the following
|
||||
-- relations :
|
||||
-- XYZMin.X() <= X <= XYZMax.X()
|
||||
-- XYZMin.Y() <= Y <= XYZMax.y()
|
||||
-- XYZMin.Z() <= Z <= XYZMax.Z()
|
||||
|
||||
|
||||
Clear (me : mutable) is virtual;
|
||||
|
||||
|
||||
Deflection (me; DomainIndex : Integer) returns Real
|
||||
---Purpose: Returns the deflection of the mesh of the domain
|
||||
-- of range <DomainIndex>.
|
||||
raises NoSuchObject
|
||||
---Purpose: Raised if <DomainIndex> is lower than 1 or greater
|
||||
-- than the number of domains.
|
||||
is virtual;
|
||||
|
||||
|
||||
IsEmpty (me) returns Boolean is virtual;
|
||||
---C++: inline
|
||||
|
||||
|
||||
NbDomains (me) returns Integer is virtual;
|
||||
---Purpose: Number of domains in the mesh.
|
||||
---C++: inline
|
||||
|
||||
|
||||
NbTriangles (me) returns Integer;
|
||||
---Purpose: Cumulative Number of triangles in the mesh.
|
||||
---C++: inline
|
||||
|
||||
|
||||
NbTriangles (me; DomainIndex : Integer) returns Integer
|
||||
---Purpose: Number of triangles in the domain of range
|
||||
-- <DomainIndex>.
|
||||
raises NoSuchObject
|
||||
---Purpose: Raised if <DomainIndex> is lower than 1 or greater
|
||||
-- than the number of domains.
|
||||
is virtual;
|
||||
|
||||
|
||||
NbVertices (me) returns Integer
|
||||
---Purpose: Cumulative Number of vertices in the mesh.
|
||||
---C++: inline
|
||||
is virtual;
|
||||
|
||||
|
||||
NbVertices (me; DomainIndex : Integer) returns Integer
|
||||
---Purpose: Number of vertices in the domain of range
|
||||
-- <DomainIndex>.
|
||||
raises NoSuchObject
|
||||
---Purpose: Raised if <DomainIndex> is lower than 1 or greater
|
||||
-- than the number of domains.
|
||||
is virtual;
|
||||
|
||||
|
||||
Triangles (me; DomainIndex : Integer = 1) returns SequenceOfMeshTriangle
|
||||
---Purpose: Returns the set of triangle of the mesh domain of range
|
||||
-- <DomainIndex>.
|
||||
---C++: return const &
|
||||
raises NoSuchObject
|
||||
---Purpose: Raised if <DomainIndex> is lower than 1 or greater
|
||||
-- than the number of domains.
|
||||
is virtual;
|
||||
|
||||
Vertices (me; DomainIndex : Integer = 1) returns SequenceOfXYZ from TColgp
|
||||
---Purpose: Returns the coordinates of the vertices of the
|
||||
-- mesh domain of range <DomainIndex>. {XV1, YV1,
|
||||
-- ZV1, XV2, YV2, ZV2, XV3,.....}
|
||||
---C++: return const &
|
||||
raises NoSuchObject
|
||||
---Purpose: Raised if <DomainIndex> is lower than 1 or greater
|
||||
-- than the number of domains.
|
||||
is virtual;
|
||||
|
||||
|
||||
fields
|
||||
|
||||
nbTriangles : Integer;
|
||||
nbVertices : Integer;
|
||||
domains : SequenceOfMeshDomain;
|
||||
xyzmax : XYZ;
|
||||
xyzmin : XYZ;
|
||||
|
||||
end Mesh;
|
164
src/StlMesh/StlMesh_Mesh.cxx
Executable file
164
src/StlMesh/StlMesh_Mesh.cxx
Executable file
@@ -0,0 +1,164 @@
|
||||
//=======================================================================
|
||||
// File: StlMesh_Mesh.cxx
|
||||
// Created: Mon Sep 25 11:27:03 1995
|
||||
// Author: Philippe GIRODENGO
|
||||
// Copyright: Matra Datavision
|
||||
|
||||
#include <StlMesh_Mesh.ixx>
|
||||
#include <StlMesh_MeshDomain.hxx>
|
||||
#include <Precision.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : StlMesh_Mesh
|
||||
//design :
|
||||
//warning :
|
||||
//=======================================================================
|
||||
|
||||
|
||||
StlMesh_Mesh::StlMesh_Mesh()
|
||||
: nbTriangles (0), nbVertices (0), xyzmax (-(Precision::Infinite()), -(Precision::Infinite()), -(Precision::Infinite())), xyzmin (Precision::Infinite(), Precision::Infinite(), Precision::Infinite())
|
||||
{ }
|
||||
|
||||
//=======================================================================
|
||||
//function : AddDomain
|
||||
//design :
|
||||
//warning :
|
||||
//=======================================================================
|
||||
|
||||
void StlMesh_Mesh::AddDomain()
|
||||
{
|
||||
Handle(StlMesh_MeshDomain) MD = new StlMesh_MeshDomain;
|
||||
domains.Append (MD);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AddDomain
|
||||
//design :
|
||||
//warning :
|
||||
//=======================================================================
|
||||
|
||||
void StlMesh_Mesh::AddDomain(const Standard_Real Deflection)
|
||||
{
|
||||
Handle(StlMesh_MeshDomain) MD = new StlMesh_MeshDomain (Deflection);
|
||||
domains.Append (MD);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AddTriangle
|
||||
//design :
|
||||
//warning :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer StlMesh_Mesh::AddTriangle(const Standard_Integer V1, const Standard_Integer V2,
|
||||
const Standard_Integer V3, const Standard_Real Xn,
|
||||
const Standard_Real Yn, const Standard_Real Zn)
|
||||
{
|
||||
nbTriangles++;
|
||||
return (domains.Last())->AddTriangle (V1, V2, V3, Xn, Yn, Zn);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AddVertex
|
||||
//design :
|
||||
//warning :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer StlMesh_Mesh::AddVertex(const Standard_Real X, const Standard_Real Y, const Standard_Real Z)
|
||||
{
|
||||
nbVertices++;
|
||||
if (X > xyzmax.X()) xyzmax.SetX (X);
|
||||
if (Y > xyzmax.Y()) xyzmax.SetY (Y);
|
||||
if (Z > xyzmax.Z()) xyzmax.SetZ (Z);
|
||||
if (X < xyzmin.X()) xyzmin.SetX (X);
|
||||
if (Y < xyzmin.Y()) xyzmin.SetY (Y);
|
||||
if (Z < xyzmin.Z()) xyzmin.SetZ (Z);
|
||||
|
||||
return (domains.Last())->AddVertex (X, Y, Z);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AddOnlyNewVertex
|
||||
//design :
|
||||
//warning :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer StlMesh_Mesh::AddOnlyNewVertex(const Standard_Real X, const Standard_Real Y, const Standard_Real Z)
|
||||
{
|
||||
Standard_Boolean IsNew = Standard_True;
|
||||
Standard_Integer VIndex = (domains.Last())->AddOnlyNewVertex (X, Y, Z, IsNew);
|
||||
if (IsNew) nbVertices++;
|
||||
return VIndex;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Bounds
|
||||
//design :
|
||||
//warning :
|
||||
//=======================================================================
|
||||
|
||||
void StlMesh_Mesh::Bounds(gp_XYZ& XYZmax, gp_XYZ& XYZmin) const
|
||||
{
|
||||
XYZmax = xyzmax;
|
||||
XYZmin = xyzmin;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Clear
|
||||
//design :
|
||||
//warning :
|
||||
//=======================================================================
|
||||
|
||||
void StlMesh_Mesh::Clear()
|
||||
{
|
||||
nbTriangles = 0;
|
||||
nbVertices = 0;
|
||||
xyzmax.SetCoord(-(Precision::Infinite()),-(Precision::Infinite()),-(Precision::Infinite()));
|
||||
xyzmin.SetCoord(Precision::Infinite(),Precision::Infinite(),Precision::Infinite());
|
||||
domains.Clear ();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Deflection
|
||||
//design :
|
||||
//warning :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real StlMesh_Mesh::Deflection(const Standard_Integer DomainIndex) const
|
||||
{return (domains.Value (DomainIndex))->Deflection ();}
|
||||
|
||||
//=======================================================================
|
||||
//function : NbTriangles
|
||||
//design :
|
||||
//warning :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer StlMesh_Mesh::NbTriangles(const Standard_Integer DomainIndex) const
|
||||
{ return (domains.Value(DomainIndex))->NbTriangles ();}
|
||||
|
||||
//=======================================================================
|
||||
//function : NbVertices
|
||||
//design :
|
||||
//warning :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer StlMesh_Mesh::NbVertices(const Standard_Integer DomainIndex) const
|
||||
{ return (domains.Value(DomainIndex))->NbVertices ();}
|
||||
|
||||
//=======================================================================
|
||||
//function : Triangles
|
||||
//design :
|
||||
//warning :
|
||||
//=======================================================================
|
||||
|
||||
const StlMesh_SequenceOfMeshTriangle& StlMesh_Mesh::Triangles(const Standard_Integer DomainIndex) const
|
||||
{ return (domains.Value (DomainIndex))->Triangles ();}
|
||||
|
||||
//=======================================================================
|
||||
//function : Vertices
|
||||
//design :
|
||||
//warning :
|
||||
//=======================================================================
|
||||
|
||||
const TColgp_SequenceOfXYZ& StlMesh_Mesh::Vertices(const Standard_Integer DomainIndex) const
|
||||
{ return (domains.Value (DomainIndex))->Vertices ();}
|
||||
|
49
src/StlMesh/StlMesh_Mesh.lxx
Executable file
49
src/StlMesh/StlMesh_Mesh.lxx
Executable file
@@ -0,0 +1,49 @@
|
||||
//=======================================================================
|
||||
// File: StlMesh_Mesh.lxx
|
||||
// Created: Mon Sep 25 09:56:46 1995
|
||||
// Author: Philippe GIRODENGO
|
||||
// Copyright: Matra Datavision
|
||||
//=======================================================================
|
||||
//function : IsEmpty
|
||||
//design :
|
||||
//warning :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean StlMesh_Mesh::IsEmpty() const
|
||||
{return domains.IsEmpty ();}
|
||||
|
||||
//=======================================================================
|
||||
//function : NbDomains
|
||||
//design :
|
||||
//warning :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Integer StlMesh_Mesh::NbDomains() const
|
||||
{ return domains.Length ();}
|
||||
|
||||
//=======================================================================
|
||||
//function : NbTriangles
|
||||
//design :
|
||||
//warning :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Integer StlMesh_Mesh::NbTriangles() const
|
||||
{return nbTriangles;}
|
||||
|
||||
//=======================================================================
|
||||
//function : NbVertices
|
||||
//design :
|
||||
//warning :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Integer StlMesh_Mesh::NbVertices() const
|
||||
{return nbVertices;}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
103
src/StlMesh/StlMesh_MeshDomain.cdl
Executable file
103
src/StlMesh/StlMesh_MeshDomain.cdl
Executable file
@@ -0,0 +1,103 @@
|
||||
-- File: StlMesh_MeshDomain.cdl
|
||||
-- Created: Tue Sep 21 09:59:49 1995
|
||||
-- Author: Philippe GIRODENGO
|
||||
---Copyright: Matra Datavision 1995
|
||||
|
||||
|
||||
|
||||
class MeshDomain from StlMesh inherits TShared from MMgt
|
||||
|
||||
---Purpose: A mesh domain is a set of triangles defined with
|
||||
-- three geometric vertices. The mesh domain has its
|
||||
-- own deflection.
|
||||
--
|
||||
uses
|
||||
SequenceOfXYZ from TColgp,
|
||||
SequenceOfMeshTriangle from StlMesh
|
||||
|
||||
|
||||
raises
|
||||
|
||||
NegativeValue from Standard,
|
||||
NullValue from Standard
|
||||
|
||||
is
|
||||
|
||||
Create returns mutable MeshDomain;
|
||||
---Purpose: The mesh deflection is defaulted to Confusion from
|
||||
-- package Precision.
|
||||
|
||||
|
||||
Create (Deflection : Real) returns mutable MeshDomain
|
||||
raises NegativeValue,
|
||||
---Purpose: Raised if the deflection is lower than zero
|
||||
NullValue;
|
||||
---Purpose: Raised if the deflection is lower than Confusion
|
||||
-- from package Precision
|
||||
|
||||
|
||||
AddTriangle (me : mutable; V1, V2, V3 : Integer; Xn, Yn, Zn : Real)
|
||||
returns Integer
|
||||
---Purpose: Build a triangle with the triplet of vertices (V1,
|
||||
-- V2, V3). This triplet defines the indexes of the
|
||||
-- vertex in the current domain The coordinates Xn,
|
||||
-- Yn, Zn defines the normal direction to the
|
||||
-- triangle. Returns the range of the triangle in
|
||||
-- the current domain.
|
||||
is virtual;
|
||||
|
||||
|
||||
AddVertex (me : mutable; X, Y, Z : Real) returns Integer
|
||||
---Purpose: Returns the range of the vertex in the current
|
||||
-- domain.
|
||||
is virtual;
|
||||
|
||||
|
||||
AddOnlyNewVertex (me : mutable; X, Y, Z : Real; IsNew : in out Boolean)
|
||||
returns Integer
|
||||
---Purpose: Returns the range of the vertex in the current
|
||||
-- domain. The current vertex is not inserted in the
|
||||
-- mesh if it already exist.
|
||||
is virtual;
|
||||
|
||||
|
||||
Deflection (me) returns Real is virtual;
|
||||
---C++: inline
|
||||
|
||||
|
||||
NbTriangles (me) returns Integer is virtual;
|
||||
---Purpose: Number of triangles in the mesh.
|
||||
---C++: inline
|
||||
|
||||
|
||||
NbVertices (me) returns Integer is virtual;
|
||||
---Purpose: Number of vertices in the mesh.
|
||||
---C++: inline
|
||||
|
||||
|
||||
Triangles (me) returns SequenceOfMeshTriangle is virtual;
|
||||
---Purpose: Returns the set of triangles of the current mesh domain
|
||||
---C++: return const &
|
||||
---C++: inline
|
||||
|
||||
|
||||
|
||||
Vertices (me) returns SequenceOfXYZ is virtual;
|
||||
---Purpose: Returns the coordinates of the vertices of the
|
||||
-- mesh domain of range <DomainIndex>. {XV1, YV1,
|
||||
-- ZV1, XV2, YV2, ZV2, XV3,.....}
|
||||
---C++: return const &
|
||||
---C++: inline
|
||||
|
||||
|
||||
fields
|
||||
|
||||
deflection : Real;
|
||||
nbVertices : Integer;
|
||||
nbTriangles : Integer;
|
||||
vertexCoords : SequenceOfXYZ;
|
||||
trianglesVertex : SequenceOfMeshTriangle;
|
||||
|
||||
end MeshDomain;
|
||||
|
||||
|
85
src/StlMesh/StlMesh_MeshDomain.cxx
Executable file
85
src/StlMesh/StlMesh_MeshDomain.cxx
Executable file
@@ -0,0 +1,85 @@
|
||||
//=======================================================================
|
||||
// File: StlMesh_MeshDomain.cxx
|
||||
// Created: Mon Sep 25 11:24:02 1995
|
||||
// Author: Philippe GIRODENGO
|
||||
// Copyright: Matra Datavision
|
||||
|
||||
#include <StlMesh_MeshDomain.ixx>
|
||||
#include <StlMesh_MeshTriangle.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <gp_XYZ.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : StlMesh_MeshDomain
|
||||
//design :
|
||||
//warning :
|
||||
//=======================================================================
|
||||
|
||||
StlMesh_MeshDomain::StlMesh_MeshDomain() : deflection (Precision::Confusion ()), nbVertices (0), nbTriangles (0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : StlMesh_MeshDomain
|
||||
//design :
|
||||
//warning :
|
||||
//=======================================================================
|
||||
|
||||
StlMesh_MeshDomain::StlMesh_MeshDomain(const Standard_Real Deflection)
|
||||
: deflection (Deflection), nbVertices (0), nbTriangles (0) { }
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : AddTriangle
|
||||
//design :
|
||||
//warning :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer StlMesh_MeshDomain::AddTriangle(const Standard_Integer V1,
|
||||
const Standard_Integer V2, const Standard_Integer V3,
|
||||
const Standard_Real Xn, const Standard_Real Yn,
|
||||
const Standard_Real Zn)
|
||||
{
|
||||
const Handle (StlMesh_MeshTriangle) tri = new StlMesh_MeshTriangle (V1, V2, V3, Xn, Yn, Zn);
|
||||
trianglesVertex.Append (tri);
|
||||
nbTriangles++;
|
||||
return nbTriangles;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AddVertex
|
||||
//design :
|
||||
//warning :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer StlMesh_MeshDomain::AddVertex(const Standard_Real X, const Standard_Real Y, const Standard_Real Z)
|
||||
{
|
||||
gp_XYZ Vx (X, Y, Z);
|
||||
vertexCoords.Append (Vx);
|
||||
nbVertices++;
|
||||
return nbVertices;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AddOnlyNewVertex
|
||||
//design : Adds the vertex only if X and Y and Z doesn`t already exists.
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer StlMesh_MeshDomain::AddOnlyNewVertex(const Standard_Real X,
|
||||
const Standard_Real Y,
|
||||
const Standard_Real Z,
|
||||
Standard_Boolean& IsNew)
|
||||
{
|
||||
gp_XYZ Vx (X, Y, Z);
|
||||
IsNew = Standard_True;
|
||||
vertexCoords.Append (Vx);
|
||||
nbVertices++;
|
||||
return nbVertices;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
51
src/StlMesh/StlMesh_MeshDomain.lxx
Executable file
51
src/StlMesh/StlMesh_MeshDomain.lxx
Executable file
@@ -0,0 +1,51 @@
|
||||
//=======================================================================
|
||||
// File: StlMesh_MeshDomain.lxx
|
||||
// Created: Mon Sep 25 10:03:46 1995
|
||||
// Author: Philippe GIRODENGO
|
||||
// Copyright: Matra Datavision
|
||||
|
||||
//=======================================================================
|
||||
//function : Deflection
|
||||
//design :
|
||||
//warning :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Real StlMesh_MeshDomain::Deflection() const
|
||||
{ return deflection; }
|
||||
|
||||
//=======================================================================
|
||||
//function : NbTriangles
|
||||
//design :
|
||||
//warning :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Integer StlMesh_MeshDomain::NbTriangles() const
|
||||
{ return nbTriangles; }
|
||||
|
||||
//=======================================================================
|
||||
//function : NbVertices
|
||||
//design :
|
||||
//warning :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Integer StlMesh_MeshDomain::NbVertices() const
|
||||
{ return nbVertices; }
|
||||
|
||||
//=======================================================================
|
||||
//function : Triangles
|
||||
//design :
|
||||
//warning :
|
||||
//=======================================================================
|
||||
|
||||
inline const StlMesh_SequenceOfMeshTriangle& StlMesh_MeshDomain::Triangles() const
|
||||
{ return trianglesVertex; }
|
||||
|
||||
//=======================================================================
|
||||
//function : Vertices
|
||||
//design :
|
||||
//warning :
|
||||
//=======================================================================
|
||||
|
||||
inline const TColgp_SequenceOfXYZ& StlMesh_MeshDomain::Vertices() const
|
||||
{ return vertexCoords; }
|
||||
|
86
src/StlMesh/StlMesh_MeshExplorer.cdl
Executable file
86
src/StlMesh/StlMesh_MeshExplorer.cdl
Executable file
@@ -0,0 +1,86 @@
|
||||
-- File: StlMesh_MeshExplorer.cdl
|
||||
-- Created: Tue Sep 21 10:06:20 1995
|
||||
-- Author: Philippe GIRODENGO
|
||||
---Copyright: Matra Datavision 1995
|
||||
|
||||
|
||||
|
||||
class MeshExplorer from StlMesh
|
||||
|
||||
---Purpose: Provides facilities to explore the triangles of
|
||||
-- each mesh domain.
|
||||
--
|
||||
uses
|
||||
|
||||
Mesh from StlMesh,
|
||||
SequenceOfMeshTriangle from StlMesh,
|
||||
SequenceOfXYZ from TColgp
|
||||
|
||||
raises
|
||||
|
||||
OutOfRange from Standard,
|
||||
NoMoreObject from Standard,
|
||||
NoSuchObject from Standard
|
||||
|
||||
is
|
||||
|
||||
Create (M : Mesh) returns MeshExplorer;
|
||||
|
||||
|
||||
Deflection (me) returns Real is static;
|
||||
---Purpose: Returns the mesh deflection of the current domain.
|
||||
|
||||
InitTriangle (me : in out; DomainIndex : Integer = 1)
|
||||
---Purpose: Initializes the exploration of the triangles of
|
||||
-- the mesh domain of range <DomainIndex>.
|
||||
raises OutOfRange
|
||||
---Purpose: Raised if <DomainIndex> is lower than 1 or greater
|
||||
-- than the number of domains.
|
||||
is static;
|
||||
|
||||
|
||||
MoreTriangle (me) returns Boolean is static;
|
||||
---C++: inline
|
||||
|
||||
|
||||
NextTriangle (me : in out)
|
||||
raises NoMoreObject
|
||||
---Purpose: Raised if there is no more triangle in the current
|
||||
-- domain.
|
||||
is static;
|
||||
|
||||
|
||||
TriangleVertices (me; X1, Y1, Z1, X2, Y2, Z2, X3, Y3, Z3 : in out Real)
|
||||
raises NoSuchObject
|
||||
---Purpose: Raised if there is no more triangle in the current
|
||||
-- domain.
|
||||
is static;
|
||||
|
||||
|
||||
TriangleOrientation (me; Xn, Yn, Zn : in out Real)
|
||||
raises NoSuchObject
|
||||
---Purpose: Raised if there is no more triangle in the current
|
||||
-- domain.
|
||||
is static;
|
||||
|
||||
|
||||
|
||||
fields
|
||||
|
||||
mesh : Mesh;
|
||||
xn, yn, zn : Real;
|
||||
v1, v2, v3 : Integer;
|
||||
domainIndex : Integer;
|
||||
nbTriangles : Integer;
|
||||
triangleIndex : Integer;
|
||||
trianglesVertex : SequenceOfXYZ;
|
||||
trianglesdef : SequenceOfMeshTriangle;
|
||||
|
||||
end MeshExplorer;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
106
src/StlMesh/StlMesh_MeshExplorer.cxx
Executable file
106
src/StlMesh/StlMesh_MeshExplorer.cxx
Executable file
@@ -0,0 +1,106 @@
|
||||
//=======================================================================
|
||||
// File: StlMesh_MeshExplorer.cxx
|
||||
// Created: Mon Sep 25 11:28:00 1995
|
||||
// Author: Philippe GIRODENGO
|
||||
// Copyright: Matra Datavision
|
||||
#include <StlMesh_MeshExplorer.ixx>
|
||||
#include <StlMesh_MeshTriangle.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : StlMesh_MeshExplorer
|
||||
//design :
|
||||
//warning :
|
||||
//=======================================================================
|
||||
|
||||
|
||||
StlMesh_MeshExplorer::StlMesh_MeshExplorer(const Handle(StlMesh_Mesh)& M)
|
||||
: domainIndex (0), nbTriangles (0) ,triangleIndex (0) { mesh = M;}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Deflection
|
||||
//design :
|
||||
//warning :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real StlMesh_MeshExplorer::Deflection() const
|
||||
{ return mesh->Deflection (domainIndex);}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : InitTriangle
|
||||
//design :
|
||||
//warning :
|
||||
//=======================================================================
|
||||
|
||||
void StlMesh_MeshExplorer::InitTriangle(const Standard_Integer DomainIndex)
|
||||
{
|
||||
triangleIndex = 1;
|
||||
domainIndex = DomainIndex;
|
||||
nbTriangles = mesh->NbTriangles (domainIndex);
|
||||
if (nbTriangles > 0) {
|
||||
trianglesdef.Assign (mesh->Triangles (DomainIndex));
|
||||
trianglesVertex.Assign (mesh->Vertices (DomainIndex));
|
||||
const Handle (StlMesh_MeshTriangle) trian = trianglesdef.First();
|
||||
trian->GetVertexAndOrientation (v1,v2,v3,xn,yn,zn);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NextTriangle
|
||||
//design :
|
||||
//warning :
|
||||
//=======================================================================
|
||||
|
||||
void StlMesh_MeshExplorer::NextTriangle()
|
||||
{
|
||||
triangleIndex++;
|
||||
if (triangleIndex <= nbTriangles) {
|
||||
const Handle (StlMesh_MeshTriangle) trian = trianglesdef.Value (triangleIndex);
|
||||
trian->GetVertexAndOrientation (v1,v2,v3,xn,yn,zn);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : TriangleVertices
|
||||
//design :
|
||||
//warning :
|
||||
//=======================================================================
|
||||
|
||||
void StlMesh_MeshExplorer::TriangleVertices(Standard_Real& X1, Standard_Real& Y1,
|
||||
Standard_Real& Z1, Standard_Real& X2,
|
||||
Standard_Real& Y2, Standard_Real& Z2,
|
||||
Standard_Real& X3, Standard_Real& Y3,
|
||||
Standard_Real& Z3) const
|
||||
{
|
||||
Standard_NoSuchObject_Raise_if (triangleIndex > nbTriangles, " StlMesh_MeshExplorer::TriangleVertices");
|
||||
|
||||
X1 = (trianglesVertex.Value(v1)).X();
|
||||
Y1 = (trianglesVertex.Value(v1)).Y();
|
||||
Z1 = (trianglesVertex.Value(v1)).Z();
|
||||
X2 = (trianglesVertex.Value(v2)).X();
|
||||
Y2 = (trianglesVertex.Value(v2)).Y();
|
||||
Z2 = (trianglesVertex.Value(v2)).Z();
|
||||
X3 = (trianglesVertex.Value(v3)).X();
|
||||
Y3 = (trianglesVertex.Value(v3)).Y();
|
||||
Z3 = (trianglesVertex.Value(v3)).Z();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : TriangleDirection
|
||||
//design :
|
||||
//warning :
|
||||
//=======================================================================
|
||||
|
||||
void StlMesh_MeshExplorer::TriangleOrientation(Standard_Real& Xn, Standard_Real& Yn, Standard_Real& Zn) const
|
||||
{
|
||||
Xn = xn;
|
||||
Yn = yn;
|
||||
Zn = zn;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
15
src/StlMesh/StlMesh_MeshExplorer.lxx
Executable file
15
src/StlMesh/StlMesh_MeshExplorer.lxx
Executable file
@@ -0,0 +1,15 @@
|
||||
//=======================================================================
|
||||
// File: StlMesh_MeshExplorer.lxx
|
||||
// Created: Mon Sep 25 10:09:46 1995
|
||||
// Author: Philippe GIRODENGO
|
||||
// Copyright: Matra Datavision
|
||||
|
||||
//=======================================================================
|
||||
//function : MoreTriangle
|
||||
//design :
|
||||
//warning :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean StlMesh_MeshExplorer::MoreTriangle() const
|
||||
{ return triangleIndex <= nbTriangles; }
|
||||
|
60
src/StlMesh/StlMesh_MeshTriangle.cdl
Executable file
60
src/StlMesh/StlMesh_MeshTriangle.cdl
Executable file
@@ -0,0 +1,60 @@
|
||||
-- File: StlMesh_MeshTriangle.cdl
|
||||
-- Created: Tue Sep 21 09:59:49 1995
|
||||
-- Author: Philippe GIRODENGO
|
||||
---Copyright: Matra Datavision 1995
|
||||
|
||||
|
||||
|
||||
class MeshTriangle from StlMesh inherits TShared from MMgt
|
||||
|
||||
---Purpose: A mesh triangle is defined with
|
||||
-- three geometric vertices and an orientation
|
||||
--
|
||||
|
||||
raises
|
||||
|
||||
NegativeValue from Standard
|
||||
|
||||
is
|
||||
|
||||
Create returns mutable MeshTriangle;
|
||||
---Purpose: empty constructor
|
||||
|
||||
|
||||
Create (V1, V2, V3 : Integer; Xn, Yn, Zn : Real) returns mutable MeshTriangle
|
||||
---Purpose: create a triangle defined with the indexes of its three vertices
|
||||
-- and its orientation
|
||||
raises NegativeValue;
|
||||
---Purpose: Raised if V1, V2 or V3 is lower than zero
|
||||
|
||||
|
||||
GetVertexAndOrientation (me; V1, V2, V3 : out Integer; Xn, Yn, Zn : out Real);
|
||||
---Purpose: get indexes of the three vertices (V1,V2,V3) and the orientation
|
||||
|
||||
SetVertexAndOrientation (me : mutable; V1, V2, V3 : in Integer; Xn, Yn, Zn : in Real)
|
||||
---Purpose: set indexes of the three vertices (V1,V2,V3) and the orientation
|
||||
raises NegativeValue;
|
||||
---Purpose: Raised if V1, V2 or V3 is lower than zero
|
||||
|
||||
|
||||
GetVertex (me; V1, V2, V3 : out Integer);
|
||||
---Purpose: get indexes of the three vertices (V1,V2,V3)
|
||||
|
||||
SetVertex (me : mutable; V1, V2, V3 : in Integer)
|
||||
---Purpose: set indexes of the three vertices (V1,V2,V3)
|
||||
raises NegativeValue;
|
||||
---Purpose: Raised if V1, V2 or V3 is lower than zero
|
||||
|
||||
|
||||
fields
|
||||
|
||||
MyV1 : Integer;
|
||||
MyV2 : Integer;
|
||||
MyV3 : Integer;
|
||||
MyXn : Real;
|
||||
MyYn : Real;
|
||||
MyZn : Real;
|
||||
|
||||
end MeshTriangle;
|
||||
|
||||
|
102
src/StlMesh/StlMesh_MeshTriangle.cxx
Executable file
102
src/StlMesh/StlMesh_MeshTriangle.cxx
Executable file
@@ -0,0 +1,102 @@
|
||||
//=======================================================================
|
||||
// File: StlMesh_MeshTriangle.cxx
|
||||
// Created: Mon Sep 25 11:24:02 1995
|
||||
// Author: Philippe GIRODENGO
|
||||
// Copyright: Matra Datavision
|
||||
|
||||
#include <StlMesh_MeshTriangle.ixx>
|
||||
#include <Precision.hxx>
|
||||
#include <gp_XYZ.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : StlMesh_MeshTriangle
|
||||
//design :
|
||||
//warning :
|
||||
//=======================================================================
|
||||
|
||||
StlMesh_MeshTriangle::StlMesh_MeshTriangle()
|
||||
: MyV1 (0), MyV2 (0), MyV3 (0), MyXn (0.0), MyYn (0.0), MyZn (0.0) { }
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : StlMesh_MeshTriangle
|
||||
//design :
|
||||
//warning :
|
||||
//=======================================================================
|
||||
|
||||
StlMesh_MeshTriangle::StlMesh_MeshTriangle(const Standard_Integer V1,
|
||||
const Standard_Integer V2,
|
||||
const Standard_Integer V3,
|
||||
const Standard_Real Xn,
|
||||
const Standard_Real Yn,
|
||||
const Standard_Real Zn)
|
||||
: MyV1 (V1), MyV2 (V2), MyV3 (V3), MyXn (Xn), MyYn (Yn), MyZn (Zn) { }
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GetVertexAndOrientation
|
||||
//design :
|
||||
//warning :
|
||||
//=======================================================================
|
||||
|
||||
void StlMesh_MeshTriangle::GetVertexAndOrientation(Standard_Integer& V1,
|
||||
Standard_Integer& V2,
|
||||
Standard_Integer& V3,
|
||||
Standard_Real& Xn,
|
||||
Standard_Real& Yn,
|
||||
Standard_Real& Zn) const
|
||||
{
|
||||
V1 = MyV1;
|
||||
V2 = MyV2;
|
||||
V3 = MyV3;
|
||||
Xn = MyXn;
|
||||
Yn = MyYn;
|
||||
Zn = MyZn;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetVertexAndOrientation
|
||||
//design :
|
||||
//warning :
|
||||
//=======================================================================
|
||||
|
||||
void StlMesh_MeshTriangle::SetVertexAndOrientation(const Standard_Integer V1, const Standard_Integer V2,
|
||||
const Standard_Integer V3, const Standard_Real Xn,
|
||||
const Standard_Real Yn, const Standard_Real Zn)
|
||||
{
|
||||
MyV1 = V1;
|
||||
MyV2 = V2;
|
||||
MyV3 = V3;
|
||||
MyXn = Xn;
|
||||
MyYn = Yn;
|
||||
MyZn = Zn;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetVertex
|
||||
//design :
|
||||
//warning :
|
||||
//=======================================================================
|
||||
|
||||
void StlMesh_MeshTriangle::GetVertex(Standard_Integer& V1, Standard_Integer& V2, Standard_Integer& V3) const
|
||||
{
|
||||
V1 = MyV1;
|
||||
V2 = MyV2;
|
||||
V3 = MyV3;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetVertex
|
||||
//design :
|
||||
//warning :
|
||||
//=======================================================================
|
||||
|
||||
void StlMesh_MeshTriangle::SetVertex(const Standard_Integer V1, const Standard_Integer V2, const Standard_Integer V3)
|
||||
{
|
||||
MyV1 = V1;
|
||||
MyV2 = V2;
|
||||
MyV3 = V3;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user