Changeset View
Changeset View
Standalone View
Standalone View
extern/draco/draco/src/draco/mesh/mesh_attribute_corner_table.h
- This file was moved from extern/draco/dracoenc/src/draco/mesh/mesh_attribute_corner_table.h.
| Show First 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | public: | ||||
| // attribute value ids is set to identity. | // attribute value ids is set to identity. | ||||
| void RecomputeVertices(const Mesh *mesh, const PointAttribute *att); | void RecomputeVertices(const Mesh *mesh, const PointAttribute *att); | ||||
| inline bool IsCornerOppositeToSeamEdge(CornerIndex corner) const { | inline bool IsCornerOppositeToSeamEdge(CornerIndex corner) const { | ||||
| return is_edge_on_seam_[corner.value()]; | return is_edge_on_seam_[corner.value()]; | ||||
| } | } | ||||
| inline CornerIndex Opposite(CornerIndex corner) const { | inline CornerIndex Opposite(CornerIndex corner) const { | ||||
| if (corner == kInvalidCornerIndex || IsCornerOppositeToSeamEdge(corner)) | if (corner == kInvalidCornerIndex || IsCornerOppositeToSeamEdge(corner)) { | ||||
| return kInvalidCornerIndex; | return kInvalidCornerIndex; | ||||
| } | |||||
| return corner_table_->Opposite(corner); | return corner_table_->Opposite(corner); | ||||
| } | } | ||||
| inline CornerIndex Next(CornerIndex corner) const { | inline CornerIndex Next(CornerIndex corner) const { | ||||
| return corner_table_->Next(corner); | return corner_table_->Next(corner); | ||||
| } | } | ||||
| inline CornerIndex Previous(CornerIndex corner) const { | inline CornerIndex Previous(CornerIndex corner) const { | ||||
| Show All 23 Lines | public: | ||||
| inline CornerIndex SwingLeft(CornerIndex corner) const { | inline CornerIndex SwingLeft(CornerIndex corner) const { | ||||
| return Next(Opposite(Next(corner))); | return Next(Opposite(Next(corner))); | ||||
| } | } | ||||
| int num_vertices() const { | int num_vertices() const { | ||||
| return static_cast<int>(vertex_to_attribute_entry_id_map_.size()); | return static_cast<int>(vertex_to_attribute_entry_id_map_.size()); | ||||
| } | } | ||||
| int num_faces() const { return static_cast<int>(corner_table_->num_faces()); } | int num_faces() const { return static_cast<int>(corner_table_->num_faces()); } | ||||
| int num_corners() const { return corner_table_->num_corners(); } | |||||
| VertexIndex Vertex(CornerIndex corner) const { | VertexIndex Vertex(CornerIndex corner) const { | ||||
| DRACO_DCHECK_LT(corner.value(), corner_to_vertex_map_.size()); | DRACO_DCHECK_LT(corner.value(), corner_to_vertex_map_.size()); | ||||
| return ConfidentVertex(corner); | return ConfidentVertex(corner); | ||||
| } | } | ||||
| VertexIndex ConfidentVertex(CornerIndex corner) const { | VertexIndex ConfidentVertex(CornerIndex corner) const { | ||||
| return corner_to_vertex_map_[corner.value()]; | return corner_to_vertex_map_[corner.value()]; | ||||
| } | } | ||||
| // Returns the attribute entry id associated to the given vertex. | // Returns the attribute entry id associated to the given vertex. | ||||
| VertexIndex VertexParent(VertexIndex vert) const { | VertexIndex VertexParent(VertexIndex vert) const { | ||||
| return VertexIndex(vertex_to_attribute_entry_id_map_[vert.value()].value()); | return VertexIndex(vertex_to_attribute_entry_id_map_[vert.value()].value()); | ||||
| } | } | ||||
| inline CornerIndex LeftMostCorner(VertexIndex v) const { | inline CornerIndex LeftMostCorner(VertexIndex v) const { | ||||
| return vertex_to_left_most_corner_map_[v.value()]; | return vertex_to_left_most_corner_map_[v.value()]; | ||||
| } | } | ||||
| inline FaceIndex Face(CornerIndex corner) const { | |||||
| return corner_table_->Face(corner); | |||||
| } | |||||
| inline CornerIndex FirstCorner(FaceIndex face) const { | |||||
| return corner_table_->FirstCorner(face); | |||||
| } | |||||
| inline std::array<CornerIndex, 3> AllCorners(FaceIndex face) const { | |||||
| return corner_table_->AllCorners(face); | |||||
| } | |||||
| inline bool IsOnBoundary(VertexIndex vert) const { | inline bool IsOnBoundary(VertexIndex vert) const { | ||||
| const CornerIndex corner = LeftMostCorner(vert); | const CornerIndex corner = LeftMostCorner(vert); | ||||
| if (corner == kInvalidCornerIndex) | if (corner == kInvalidCornerIndex) { | ||||
| return true; | |||||
| } | |||||
| if (SwingLeft(corner) == kInvalidCornerIndex) { | |||||
| return true; | return true; | ||||
| return IsCornerOnSeam(corner); | } | ||||
| return false; | |||||
| } | } | ||||
| bool no_interior_seams() const { return no_interior_seams_; } | bool no_interior_seams() const { return no_interior_seams_; } | ||||
| const CornerTable *corner_table() const { return corner_table_; } | const CornerTable *corner_table() const { return corner_table_; } | ||||
| // TODO(draco-eng): extract valence functions into a reusable class/object | // TODO(draco-eng): extract valence functions into a reusable class/object | ||||
| // also from 'corner_table.*' | // also from 'corner_table.*' | ||||
| // Returns the valence (or degree) of a vertex. | // Returns the valence (or degree) of a vertex. | ||||
| // Returns -1 if the given vertex index is not valid. | // Returns -1 if the given vertex index is not valid. | ||||
| int Valence(VertexIndex v) const; | int Valence(VertexIndex v) const; | ||||
| // Same as above but does not check for validity and does not return -1 | // Same as above but does not check for validity and does not return -1 | ||||
| int ConfidentValence(VertexIndex v) const; | int ConfidentValence(VertexIndex v) const; | ||||
| // Returns the valence of the vertex at the given corner. | // Returns the valence of the vertex at the given corner. | ||||
| inline int Valence(CornerIndex c) const { | inline int Valence(CornerIndex c) const { | ||||
| DRACO_DCHECK_LT(c.value(), corner_table_->num_corners()); | DRACO_DCHECK_LT(c.value(), corner_table_->num_corners()); | ||||
| if (c == kInvalidCornerIndex) | if (c == kInvalidCornerIndex) { | ||||
| return -1; | return -1; | ||||
| } | |||||
| return ConfidentValence(c); | return ConfidentValence(c); | ||||
| } | } | ||||
| inline int ConfidentValence(CornerIndex c) const { | inline int ConfidentValence(CornerIndex c) const { | ||||
| DRACO_DCHECK_LT(c.value(), corner_table_->num_corners()); | DRACO_DCHECK_LT(c.value(), corner_table_->num_corners()); | ||||
| return ConfidentValence(Vertex(c)); | return ConfidentValence(Vertex(c)); | ||||
| } | } | ||||
| // Allows access to an internal object for caching valences. The object can | // Allows access to an internal object for caching valences. The object can | ||||
| Show All 39 Lines | |||||