14#ifndef EGGMESHERSTRIP_H
15#define EGGMESHERSTRIP_H
30class EXPCL_PANDA_EGG EggMesherStrip {
52 EggMesherStrip(PrimType prim_type, MesherOrigin origin);
55 INLINE EggMesherStrip(
const EggMesherStrip ©);
60 int &num_prims,
int &num_rows,
61 int first_row_id,
int this_row_id,
62 int this_row_distance);
63 void cut_sheet(
int first_row_id,
int do_mate,
72 EggMesherStrip &back, PrimType type);
73 static bool must_invert(
const EggMesherStrip &front,
const EggMesherStrip &back,
74 bool will_reverse_back, PrimType type);
81 INLINE
bool is_coplanar_with(
const EggMesherStrip &other, PN_stdfloat threshold)
const;
82 INLINE PN_stdfloat
coplanarity(
const EggMesherStrip &other)
const;
108 INLINE
bool operator == (
const EggMesherStrip &other)
const;
109 INLINE
bool operator != (
const EggMesherStrip &other)
const;
111 bool pick_mate(
const EggMesherStrip &a_strip,
const EggMesherStrip &b_strip,
116 const EggMesherStrip &b_strip)
const;
118 void output(std::ostream &out)
const;
137 MesherStatus _status;
140 LNormald _plane_normal;
141 PN_stdfloat _plane_offset;
142 int _row_id, _row_distance;
143 MesherOrigin _origin;
Represents one edge of a triangle, as used by the EggMesher to discover connected triangles.
Represents a triangle strip or quad strip in progress, as assembled by the mesher.
EggMesherEdge get_tail_edge() const
Returns an EggMesherEdge which represents the trailing edge in the quadstrip or tristrip.
bool invert()
Reverses the facing of a quadstrip by reversing pairs of vertices.
void rotate_forward()
Rotates a triangle or quad by bringing its first vertex to the back.
bool is_coplanar_with(const EggMesherStrip &other, PN_stdfloat threshold) const
Returns true if the strip and the other strip are coplanar, within the indicated threshold.
bool find_ideal_mate(EggMesherStrip *&mate, EggMesherEdge *&common_edge, const EggVertexPool *vertex_pool)
Searches our neighbors for the most suitable mate.
EggMesherEdge get_head_edge() const
Returns an EggMesherEdge which represents the leading edge in the quadstrip or tristrip.
void output_neighbors(std::ostream &out) const
Writes all the neighbor indexes to the ostream.
bool mate(const EggVertexPool *vertex_pool)
Finds a neighboring strip and joins up with it to make a larger strip.
static bool must_invert(const EggMesherStrip &front, const EggMesherStrip &back, bool will_reverse_back, PrimType type)
Returns false if the strips can be mated as they currently are.
int count_neighbors() const
Returns the number of neighbors the strip shares.
int type_category() const
Returns an integer which gives a heuristic about the similarity of different strip types.
static bool mate_strips(EggMesherEdge *common_edge, EggMesherStrip &front, EggMesherStrip &back, PrimType type)
Stitches two strips together, producing in "front" a new strip of the indicated type (quadstrip or tr...
void combine_edges(EggMesherStrip &other, int remove_sides)
Removes the edges from the given strip and appends them to our own.
void rotate_back()
Rotates a triangle or quad by bringing its last vertex to the front.
bool pick_mate(const EggMesherStrip &a_strip, const EggMesherStrip &b_strip, const EggMesherEdge &a_edge, const EggMesherEdge &b_edge, const EggVertexPool *vertex_pool) const
Defines an ordering to select neighbors to mate with.
bool pick_sheet_mate(const EggMesherStrip &a_strip, const EggMesherStrip &b_strip) const
Defines an ordering to select neighbors to follow when measuring out a quadsheet.
static bool mate_pieces(EggMesherEdge *common_edge, EggMesherStrip &front, EggMesherStrip &back, const EggVertexPool *vertex_pool)
Connects two pieces of arbitrary type, if possible.
bool can_invert() const
Returns true if the strip can be inverted (reverse its facing direction).
PN_stdfloat coplanarity(const EggMesherStrip &other) const
Returns the degree to which the two strips are coplanar.
bool is_odd() const
Returns true if the tristrip or quadstrip contains an odd number of pieces.
const EggMesherEdge * find_opposite_edge(int vi) const
Returns the first edge found that does not contain the given vertex.
void measure_sheet(const EggMesherEdge *edge, int new_row, int &num_prims, int &num_rows, int first_row_id, int this_row_id, int this_row_distance)
Determines the extents of the quadsheet that can be derived by starting with this strip,...
int find_uncommon_vertex(const EggMesherEdge *edge) const
Returns the first vertex found that is not shared by the given edge.
void output(std::ostream &out) const
Formats the vertex for output in some sensible way.
void rotate_to_front(const EggMesherEdge *edge)
Rotates a triangle or quad so that the given edge is first in the vertex list.
bool would_reverse_tail(PrimType want_type) const
Returns true if convert_to_type() would reverse the tail edge of the given strip, false otherwise.
void remove_all_edges()
Removes all active edges from the strip.
static bool convex_quad(EggMesherEdge *common_edge, EggMesherStrip &front, EggMesherStrip &back, const EggVertexPool *vertex_pool)
Returns true if the quad that would be formed by connecting coplanar tris front and back along common...
void rotate_to_back(const EggMesherEdge *edge)
Rotates a triangle or quad so that the given edge is last in the vertex list.
const EggMesherEdge * find_adjacent_edge(const EggMesherEdge *edge) const
Returns the first edge found that shares exactly one vertex with the given edge.
void convert_to_type(PrimType want_type)
Converts the EggMesherStrip from whatever form it is–triangle, quad, or quadstrip–into a tristrip or ...
A base class for any of a number of kinds of geometry primitives: polygons, point lights,...
A collection of vertices.
This is our own Panda specialization on the default STL list.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.