22 using FaEdge = std::pair<size_t,size_t>;
54 const FaVec3& normal,
double z0,
55 double zeroTol = 1.0e-16);
64 size_t addFace(
int v1,
int v2,
int v3,
int v4 = -1);
76 bool writeCAD(
const std::string& fileName,
const FaMat34& partCS)
const;
87 static void readWRL1 (
FFaBody*& body, std::istream& in);
88 static void readWRL2 (
FFaBody*& body, std::istream& in);
96 void readIndexedFaceSet(std::istream& in,
const FaMat34& partCS);
97 void readBody(std::istream& in,
const FaMat34& partCS);
98 void readCoords(std::istream& in,
const FaMat34& partCS,
char endChar =
'}');
99 void readFaces(std::istream& in,
char endChar =
'}');
100 void readFace(std::istream& in);
137 int intersect(
const FaVec3& normal,
double z0,
double zeroTol = 1.0e-16);
185 return i >= 0 && (size_t)i <
myFaces[idx].size() ?
myFaces[idx][i] : -1;
std::pair< size_t, size_t > FaEdge
Vertex indices of an edge.
Definition: FFaBody.H:22
2nd order symmetric tensors in 3D space.
Point vectors in 3D space.
Class representing the surface geometry a volumetric object.
Definition: FFaBody.H:36
FaVec3 myCentroid
The volume centroid of this body.
Definition: FFaBody.H:117
FFaTensor3 myInertia
The volume intertia of this body.
Definition: FFaBody.H:116
std::vector< FaFace > myFaces
Face container of the body.
Definition: FFaBody.H:110
bool writeCAD(const std::string &fileName, const FaMat34 &partCS) const
Exports the body to specified CAD file.
Definition: FFaBodyParser.C:607
std::vector< FaEdge > myIntLoop
Edges of the intersection surface.
Definition: FFaBody.H:113
bool computeBoundingBox(FaVec3 &minX, FaVec3 &maxX) const
Computes the bounding box of the body.
Definition: FFaBody.C:445
int getFaceVtx(size_t idx, int i) const
Returns the global index of a face vertex.
Definition: FFaBody.H:183
static FFaBody * readWRL(std::istream &in, int version)
Creates a new body by parsing VRML content from an input stream.
Definition: FFaBodyParser.C:267
static FFaBody * readSTL(std::istream &in, double duplTol)
Creates a new body by parsing STL content from an input stream.
Definition: FFaBodyParser.C:159
static FFaBody * readFromCAD(std::istream &in, double duplTol=-1.0)
Creates a new body by parsing the given input stream.
Definition: FFaBodyParser.C:139
bool computeVolumeBelow(double &Vb, double &As, FaVec3 &C0b, FaVec3 &C0s, const FaVec3 &normal, double z0, double zeroTol=1.0e-16)
Computes the volume of a body portion below of given plane.
Definition: FFaBody.C:515
std::vector< FaVec3 > myVertices
Vertex container of the body.
Definition: FFaBody.H:109
const FaVec3 & getVertex(size_t idx) const
Returns the coordinates of a specified vertex.
Definition: FFaBody.H:68
std::vector< FaVec3 > myLoopVer
Vertices defining the intersection.
Definition: FFaBody.H:112
bool computeTotalVolume(double &Vb, FaVec3 &C0b, FFaTensor3 *Ib=NULL) const
Computes the total volume and volume centroid of the body.
Definition: FFaBody.C:461
size_t getNoVertices() const
Returns the total number of vertices in the body.
Definition: FFaBody.H:43
bool computeIncArea(double &dAs, FaVec3 &C0s, const FaVec3 &normal, const FaMat34 &cs)
Computes the intersection area increment.
Definition: FFaBody.C:637
size_t addFace(int v1, int v2, int v3, int v4=-1)
Adds a face to the body definition.
Definition: FFaBody.C:409
FFaBody()
Default constructor.
Definition: FFaBody.H:39
bool isBBoxComputed
If true, myBBox is defined.
Definition: FFaBody.H:107
double myVolume
The volume of this body.
Definition: FFaBody.H:115
char isVolumeComputed
If true, myVolume is computed.
Definition: FFaBody.H:114
size_t getNoFaces() const
Returns the total number of faces in the body.
Definition: FFaBody.H:45
size_t addVertex(const FaVec3 &pos, double tol=-1.0)
Adds a vertex to the body definition.
Definition: FFaBody.C:419
FaVec3 myBBox[2]
Bounding box of the body.
Definition: FFaBody.H:108
static std::string prefix
File prefix to use for included files.
Definition: FFaBody.H:104
size_t startVx
Number of vertices before intersected.
Definition: FFaBody.H:118
static FFaBody * readCAD(std::istream &in)
Creates a new body by parsing CAD content from an input stream.
Definition: FFaBodyParser.C:235
FaVec3 myX0s
Centroid of the plane intersection.
Definition: FFaBody.H:111
bool saveIntersection(const FaMat34 &cs)
Saves current plane intersection.
Definition: FFaBody.C:588
Class to represent a 3D symmetric tensor.
Definition: FFaTensor3.H:35
Class representing a surface segment of a FFaBody object.
Definition: FFaBody.H:129
std::vector< FaFace > mySubFaces
2 or 3 sub-triangles of intersected face
Definition: FFaBody.H:176
bool isIntersected() const
Returns true if face is intersected by the intersection plane.
Definition: FFaBody.H:139
FFaBody * owner
Pointer to the body object containing this face.
Definition: FFaBody.H:179
const std::vector< FaFace > & getSubFaces() const
Returns the sub-faces of the face when it is intersected.
Definition: FFaBody.H:156
int intersect(const FaVec3 &normal, double z0, double zeroTol=1.0e-16)
Calculates the intersection with a given plane.
Definition: FFaBody.C:110
const FaVec3 & vertex(int i) const
Returns the coordinates of the i'th vertex of this face.
Definition: FFaBody.H:148
size_t operator[](int i) const
Returns the global index of the i'th vertex of this face.
Definition: FFaBody.H:146
FFaBody * getBody() const
Returns the owner of this face.
Definition: FFaBody.H:162
size_t size() const
Returns the number of face vertices.
Definition: FFaBody.H:144
friend std::ostream & operator<<(std::ostream &s, const FaFace &f)
Global stream operator printing the face definition.
FaFace()
Default face constructor.
Definition: FFaBody.C:63
bool isBelow() const
Returns true if face is totally below the intersection plane.
Definition: FFaBody.H:141
int quad2Quads(const char *status, const double *dist)
Divides the face into two quadrilateral sub-faces.
Definition: FFaBody.C:270
FaVec3 getIntEdgeCoord() const
Returns the sum of the end points of the intersecting edge.
Definition: FFaBody.C:382
FaEdge iEdge
Vertices of the intersection edge, if any.
Definition: FFaBody.H:175
double accumulateArea(const FaVec3 &vn, const FaVec3 &v0, FaVec3 &X) const
Accumulates area of an intersection surface.
Definition: FFaBody.C:371
double accumulateVolume(const FaVec3 &v0, FaVec3 &X, FFaTensor3 *I) const
Accumulates volume with contribution from *this as surface segment.
Definition: FFaBody.C:394
std::vector< size_t > myVertices
Indices to the vertices defining the face.
Definition: FFaBody.H:174
FaEdge getIntEdge() const
Returns the index of the intersecting edge.
Definition: FFaBody.H:158
int quad2QuadTria(const char *status, const double *dist, bool oneAbove)
Divides the face into one triangle and two quadrilaterals.
Definition: FFaBody.C:327
bool IAmBelow
Is face below current intersection plane?
Definition: FFaBody.H:177
Class for positions in 3D space.
Definition: FFaMat34.H:32
Class for point vectors in 3D space.
Definition: FFaVec3.H:40
real(sp) version
Model file version.
Definition: headingNamelistModule.f90:22
real(dp), dimension(:), allocatable v0
Definition: inverseModule.f90:26
real(dp), dimension(:), allocatable v1
Definition: inverseModule.f90:27
real(dp), dimension(:), allocatable v2
Definition: inverseModule.f90:28
integer, parameter i4
4-byte integer
Definition: kindModule.f90:18
real(dp) function dist(a, b, g)
Calculates the distance between the angles a,b,g and euler.
Definition: rotationModule.f90:274