|
Jet
v1.3.3
|
3-D triangle mesh geometry. More...
#include <jet/triangle_mesh3.h>
Classes | |
| class | Builder |
| Front-end to create TriangleMesh3 objects step by step. More... | |
Public Types | |
| typedef Array1< Vector2D > | Vector2DArray |
| typedef Array1< Vector3D > | Vector3DArray |
| typedef Array1< Point3UI > | IndexArray |
| typedef Vector3DArray | PointArray |
| typedef Vector3DArray | NormalArray |
| typedef Vector2DArray | UvArray |
Public Member Functions | |
| TriangleMesh3 (const Transform3 &transform=Transform3(), bool isNormalFlipped=false) | |
| Default constructor. More... | |
| TriangleMesh3 (const PointArray &points, const NormalArray &normals, const UvArray &uvs, const IndexArray &pointIndices, const IndexArray &normalIndices, const IndexArray &uvIndices, const Transform3 &transform_=Transform3(), bool isNormalFlipped=false) | |
| Constructs mesh with points, normals, uvs, and their indices. More... | |
| TriangleMesh3 (const TriangleMesh3 &other) | |
| Copy constructor. More... | |
| void | updateQueryEngine () override |
| Updates internal spatial query engine. More... | |
| void | updateQueryEngine () const |
| Updates internal spatial query engine. More... | |
| void | clear () |
| Clears all content. More... | |
| void | set (const TriangleMesh3 &other) |
Copies the contents from other mesh. More... | |
| void | swap (TriangleMesh3 &other) |
Swaps the contents with other mesh. More... | |
| double | area () const |
| Returns area of this mesh. More... | |
| double | volume () const |
| Returns volume of this mesh. More... | |
| const Vector3D & | point (size_t i) const |
| Returns constant reference to the i-th point. More... | |
| Vector3D & | point (size_t i) |
| Returns reference to the i-th point. More... | |
| const Vector3D & | normal (size_t i) const |
| Returns constant reference to the i-th normal. More... | |
| Vector3D & | normal (size_t i) |
| Returns reference to the i-th normal. More... | |
| const Vector2D & | uv (size_t i) const |
| Returns constant reference to the i-th UV coordinates. More... | |
| Vector2D & | uv (size_t i) |
| Returns reference to the i-th UV coordinates. More... | |
| const Point3UI & | pointIndex (size_t i) const |
| Returns constant reference to the point indices of i-th triangle. More... | |
| Point3UI & | pointIndex (size_t i) |
| Returns reference to the point indices of i-th triangle. More... | |
| const Point3UI & | normalIndex (size_t i) const |
| Returns constant reference to the normal indices of i-th triangle. More... | |
| Point3UI & | normalIndex (size_t i) |
| Returns reference to the normal indices of i-th triangle. More... | |
| const Point3UI & | uvIndex (size_t i) const |
| Returns constant reference to the UV indices of i-th triangle. More... | |
| Point3UI & | uvIndex (size_t i) |
| Returns reference to the UV indices of i-th triangle. More... | |
| Triangle3 | triangle (size_t i) const |
| Returns i-th triangle. More... | |
| size_t | numberOfPoints () const |
| Returns number of points. More... | |
| size_t | numberOfNormals () const |
| Returns number of normals. More... | |
| size_t | numberOfUvs () const |
| Returns number of UV coordinates. More... | |
| size_t | numberOfTriangles () const |
| Returns number of triangles. More... | |
| bool | hasNormals () const |
| Returns true if the mesh has normals. More... | |
| bool | hasUvs () const |
| Returns true if the mesh has UV coordinates. More... | |
| void | addPoint (const Vector3D &pt) |
| Adds a point. More... | |
| void | addNormal (const Vector3D &n) |
| Adds a normal. More... | |
| void | addUv (const Vector2D &t) |
| Adds a UV. More... | |
| void | addPointTriangle (const Point3UI &newPointIndices) |
| Adds a triangle with points. More... | |
| void | addNormalTriangle (const Point3UI &newNormalIndices) |
| Adds a triangle with normal. More... | |
| void | addUvTriangle (const Point3UI &newUvIndices) |
| Adds a triangle with UV. More... | |
| void | addPointNormalTriangle (const Point3UI &newPointIndices, const Point3UI &newNormalIndices) |
| Adds a triangle with point and normal. More... | |
| void | addPointUvNormalTriangle (const Point3UI &newPointIndices, const Point3UI &newUvIndices, const Point3UI &newNormalIndices) |
| Adds a triangle with point, normal, and UV. More... | |
| void | addPointUvTriangle (const Point3UI &newPointIndices, const Point3UI &newUvIndices) |
| Adds a triangle with point and UV. More... | |
| void | addTriangle (const Triangle3 &tri) |
| Add a triangle. More... | |
| void | setFaceNormal () |
| Sets entire normals to the face normals. More... | |
| void | setAngleWeightedVertexNormal () |
| Sets angle weighted vertex normal. More... | |
| void | scale (double factor) |
| Scales the mesh by given factor. More... | |
| void | translate (const Vector3D &t) |
| Translates the mesh. More... | |
| void | rotate (const QuaternionD &q) |
| Rotates the mesh. More... | |
| void | writeObj (std::ostream *strm) const |
| Writes the mesh in obj format to the output stream. More... | |
| bool | writeObj (const std::string &filename) const |
| Writes the mesh in obj format to the file. More... | |
| bool | readObj (std::istream *strm) |
| Reads the mesh in obj format from the input stream. More... | |
| bool | readObj (const std::string &filename) |
| Reads the mesh in obj format from the file. More... | |
| TriangleMesh3 & | operator= (const TriangleMesh3 &other) |
Copies other mesh. More... | |
Public Member Functions inherited from jet::Surface3 | |
| Surface3 (const Transform3 &transform=Transform3(), bool isNormalFlipped=false) | |
| Constructs a surface with normal direction. More... | |
| Surface3 (const Surface3 &other) | |
| Copy constructor. More... | |
| virtual | ~Surface3 () |
| Default destructor. More... | |
| Vector3D | closestPoint (const Vector3D &otherPoint) const |
| BoundingBox3D | boundingBox () const |
| Returns the bounding box of this surface object. More... | |
| bool | intersects (const Ray3D &ray) const |
Returns true if the given ray intersects with this surface object. More... | |
| double | closestDistance (const Vector3D &otherPoint) const |
| SurfaceRayIntersection3 | closestIntersection (const Ray3D &ray) const |
Returns the closest intersection point for given ray. More... | |
| Vector3D | closestNormal (const Vector3D &otherPoint) const |
| virtual bool | isBounded () const |
| Returns true if bounding box can be defined. More... | |
| virtual bool | isValidGeometry () const |
| Returns true if the surface is a valid geometry. More... | |
| bool | isInside (const Vector3D &otherPoint) const |
Static Public Member Functions | |
| static Builder | builder () |
| Returns builder fox TriangleMesh3. More... | |
Protected Member Functions | |
| Vector3D | closestPointLocal (const Vector3D &otherPoint) const override |
| double | closestDistanceLocal (const Vector3D &otherPoint) const override |
| bool | intersectsLocal (const Ray3D &ray) const override |
| BoundingBox3D | boundingBoxLocal () const override |
| Returns the bounding box of this surface object in local frame. More... | |
| Vector3D | closestNormalLocal (const Vector3D &otherPoint) const override |
| SurfaceRayIntersection3 | closestIntersectionLocal (const Ray3D &ray) const override |
Returns the closest intersection point for given ray in local frame. More... | |
| bool | isInsideLocal (const Vector3D &otherPoint) const override |
Additional Inherited Members | |
Public Attributes inherited from jet::Surface3 | |
| Transform3 | transform |
| Local-to-world transform. More... | |
| bool | isNormalFlipped = false |
| Flips normal when calling Surface3::closestNormal(...). More... | |
3-D triangle mesh geometry.
This class represents 3-D triangle mesh geometry which extends Surface3 by overriding surface-related queries. The mesh structure stores point, normals, and UV coordinates.
| typedef Array1<Point3UI> jet::TriangleMesh3::IndexArray |
| jet::TriangleMesh3::TriangleMesh3 | ( | const Transform3 & | transform = Transform3(), |
| bool | isNormalFlipped = false |
||
| ) |
Default constructor.
| jet::TriangleMesh3::TriangleMesh3 | ( | const PointArray & | points, |
| const NormalArray & | normals, | ||
| const UvArray & | uvs, | ||
| const IndexArray & | pointIndices, | ||
| const IndexArray & | normalIndices, | ||
| const IndexArray & | uvIndices, | ||
| const Transform3 & | transform_ = Transform3(), |
||
| bool | isNormalFlipped = false |
||
| ) |
Constructs mesh with points, normals, uvs, and their indices.
| jet::TriangleMesh3::TriangleMesh3 | ( | const TriangleMesh3 & | other | ) |
Copy constructor.
| void jet::TriangleMesh3::addNormal | ( | const Vector3D & | n | ) |
Adds a normal.
| void jet::TriangleMesh3::addNormalTriangle | ( | const Point3UI & | newNormalIndices | ) |
Adds a triangle with normal.
| void jet::TriangleMesh3::addPoint | ( | const Vector3D & | pt | ) |
Adds a point.
| void jet::TriangleMesh3::addPointNormalTriangle | ( | const Point3UI & | newPointIndices, |
| const Point3UI & | newNormalIndices | ||
| ) |
Adds a triangle with point and normal.
| void jet::TriangleMesh3::addPointTriangle | ( | const Point3UI & | newPointIndices | ) |
Adds a triangle with points.
| void jet::TriangleMesh3::addPointUvNormalTriangle | ( | const Point3UI & | newPointIndices, |
| const Point3UI & | newUvIndices, | ||
| const Point3UI & | newNormalIndices | ||
| ) |
Adds a triangle with point, normal, and UV.
| void jet::TriangleMesh3::addPointUvTriangle | ( | const Point3UI & | newPointIndices, |
| const Point3UI & | newUvIndices | ||
| ) |
Adds a triangle with point and UV.
| void jet::TriangleMesh3::addTriangle | ( | const Triangle3 & | tri | ) |
Add a triangle.
| void jet::TriangleMesh3::addUv | ( | const Vector2D & | t | ) |
Adds a UV.
| void jet::TriangleMesh3::addUvTriangle | ( | const Point3UI & | newUvIndices | ) |
Adds a triangle with UV.
| double jet::TriangleMesh3::area | ( | ) | const |
Returns area of this mesh.
|
overrideprotectedvirtual |
Returns the bounding box of this surface object in local frame.
Implements jet::Surface3.
|
static |
Returns builder fox TriangleMesh3.
| void jet::TriangleMesh3::clear | ( | ) |
Clears all content.
|
overrideprotectedvirtual |
Returns the closest distance from the given point otherPoint to the point on the surface in local frame.
Reimplemented from jet::Surface3.
|
overrideprotectedvirtual |
Returns the closest intersection point for given ray in local frame.
Implements jet::Surface3.
|
overrideprotectedvirtual |
Returns the normal to the closest point on the surface from the given point otherPoint in local frame.
Implements jet::Surface3.
|
overrideprotectedvirtual |
Returns the closest point from the given point otherPoint to the surface in local frame.
Implements jet::Surface3.
| bool jet::TriangleMesh3::hasNormals | ( | ) | const |
Returns true if the mesh has normals.
| bool jet::TriangleMesh3::hasUvs | ( | ) | const |
Returns true if the mesh has UV coordinates.
|
overrideprotectedvirtual |
Returns true if the given ray intersects with this surface object in local frame.
Reimplemented from jet::Surface3.
|
overrideprotectedvirtual |
Returns true if otherPoint is inside by given depth the volume defined by the surface in local frame.
Reimplemented from jet::Surface3.
| Vector3D& jet::TriangleMesh3::normal | ( | size_t | i | ) |
Returns reference to the i-th normal.
| const Vector3D& jet::TriangleMesh3::normal | ( | size_t | i | ) | const |
Returns constant reference to the i-th normal.
| Point3UI& jet::TriangleMesh3::normalIndex | ( | size_t | i | ) |
Returns reference to the normal indices of i-th triangle.
| const Point3UI& jet::TriangleMesh3::normalIndex | ( | size_t | i | ) | const |
Returns constant reference to the normal indices of i-th triangle.
| size_t jet::TriangleMesh3::numberOfNormals | ( | ) | const |
Returns number of normals.
| size_t jet::TriangleMesh3::numberOfPoints | ( | ) | const |
Returns number of points.
| size_t jet::TriangleMesh3::numberOfTriangles | ( | ) | const |
Returns number of triangles.
| size_t jet::TriangleMesh3::numberOfUvs | ( | ) | const |
Returns number of UV coordinates.
| TriangleMesh3& jet::TriangleMesh3::operator= | ( | const TriangleMesh3 & | other | ) |
Copies other mesh.
| Vector3D& jet::TriangleMesh3::point | ( | size_t | i | ) |
Returns reference to the i-th point.
| const Vector3D& jet::TriangleMesh3::point | ( | size_t | i | ) | const |
Returns constant reference to the i-th point.
| Point3UI& jet::TriangleMesh3::pointIndex | ( | size_t | i | ) |
Returns reference to the point indices of i-th triangle.
| const Point3UI& jet::TriangleMesh3::pointIndex | ( | size_t | i | ) | const |
Returns constant reference to the point indices of i-th triangle.
| bool jet::TriangleMesh3::readObj | ( | const std::string & | filename | ) |
Reads the mesh in obj format from the file.
| bool jet::TriangleMesh3::readObj | ( | std::istream * | strm | ) |
Reads the mesh in obj format from the input stream.
| void jet::TriangleMesh3::rotate | ( | const QuaternionD & | q | ) |
Rotates the mesh.
| void jet::TriangleMesh3::scale | ( | double | factor | ) |
Scales the mesh by given factor.
| void jet::TriangleMesh3::set | ( | const TriangleMesh3 & | other | ) |
Copies the contents from other mesh.
| void jet::TriangleMesh3::setAngleWeightedVertexNormal | ( | ) |
Sets angle weighted vertex normal.
| void jet::TriangleMesh3::setFaceNormal | ( | ) |
Sets entire normals to the face normals.
| void jet::TriangleMesh3::swap | ( | TriangleMesh3 & | other | ) |
Swaps the contents with other mesh.
| void jet::TriangleMesh3::translate | ( | const Vector3D & | t | ) |
Translates the mesh.
| Triangle3 jet::TriangleMesh3::triangle | ( | size_t | i | ) | const |
Returns i-th triangle.
| void jet::TriangleMesh3::updateQueryEngine | ( | ) | const |
Updates internal spatial query engine.
|
overridevirtual |
Updates internal spatial query engine.
Reimplemented from jet::Surface3.
| Vector2D& jet::TriangleMesh3::uv | ( | size_t | i | ) |
Returns reference to the i-th UV coordinates.
| const Vector2D& jet::TriangleMesh3::uv | ( | size_t | i | ) | const |
Returns constant reference to the i-th UV coordinates.
| Point3UI& jet::TriangleMesh3::uvIndex | ( | size_t | i | ) |
Returns reference to the UV indices of i-th triangle.
| const Point3UI& jet::TriangleMesh3::uvIndex | ( | size_t | i | ) | const |
Returns constant reference to the UV indices of i-th triangle.
| double jet::TriangleMesh3::volume | ( | ) | const |
Returns volume of this mesh.
| bool jet::TriangleMesh3::writeObj | ( | const std::string & | filename | ) | const |
Writes the mesh in obj format to the file.
| void jet::TriangleMesh3::writeObj | ( | std::ostream * | strm | ) | const |
Writes the mesh in obj format to the output stream.
1.8.18