28 constexpr
int NO_INDEX = -1;
52 Vert(
const mpq3 &mco,
const double3 &dco,
int id,
int orig);
78 Plane(
const mpq3 &norm_exact,
const mpq_class &d_exact);
87 void make_canonical();
91 bool exact_populated()
const;
92 void populate_exact();
95 std::ostream &
operator<<(std::ostream &os,
const Plane *plane);
113 struct Face : NonCopyable {
114 Array<const Vert *> vert;
115 Array<int> edge_orig;
116 Array<bool> is_intersect;
117 Plane *plane =
nullptr;
124 Face(Span<const Vert *>
verts,
int id,
int orig, Span<int> edge_origs, Span<bool> is_intersect);
125 Face(Span<const Vert *>
verts,
int id,
int orig);
130 return vert.size() == 3;
137 bool cyclic_equal(
const Face &other)
const;
139 FacePos next_pos(FacePos p)
const
141 return (p + 1) % vert.size();
144 FacePos prev_pos(FacePos p)
const
146 return (p + vert.size() - 1) % vert.size();
159 const Vert *
const *begin()
const
164 const Vert *
const *end()
const
169 IndexRange index_range()
const
171 return IndexRange(vert.size());
174 void populate_plane(
bool need_exact);
176 bool plane_populated()
const
178 return plane !=
nullptr;
191 class IMeshArena : NonCopyable, NonMovable {
192 class IMeshArenaImpl;
193 std::unique_ptr<IMeshArenaImpl> pimpl_;
203 void reserve(
int vert_num_hint,
int face_num_hint);
205 int tot_allocated_verts()
const;
206 int tot_allocated_faces()
const;
214 const Vert *add_or_find_vert(
const mpq3 &co,
int orig);
215 const Vert *add_or_find_vert(
const double3 &co,
int orig);
216 const Vert *add_or_find_vert(
Vert *vert);
220 Span<int> edge_origs,
221 Span<bool> is_intersect);
222 Face *add_face(Span<const Vert *>
verts,
int orig, Span<int> edge_origs);
223 Face *add_face(Span<const Vert *>
verts,
int orig);
226 const Vert *find_vert(
const mpq3 &co)
const;
227 const Face *find_face(Span<const Vert *>
verts)
const;
243 Array<const Vert *> vert_;
244 Map<const Vert *, int> vert_to_index_;
245 bool vert_populated_ =
false;
253 void set_faces(Span<Face *>
faces);
254 Face *face(
int index)
const
259 int face_size()
const
264 int vert_size()
const
269 bool has_verts()
const
271 return vert_populated_;
274 void set_dirty_verts()
276 vert_populated_ =
false;
277 vert_to_index_.clear();
278 vert_ = Array<const Vert *>();
282 void populate_vert();
283 void populate_vert(
int max_verts);
285 const Vert *vert(
int index)
const
292 int lookup_vert(
const Vert *
v)
const;
294 IndexRange vert_index_range()
const
297 return IndexRange(vert_.size());
300 IndexRange face_index_range()
const
302 return IndexRange(face_.size());
305 Span<const Vert *> vertices()
const
308 return Span<const Vert *>(vert_);
311 Span<Face *>
faces()
const
313 return Span<Face *>(face_);
325 bool erase_face_positions(
int f_index, Span<bool> face_pos_erase, IMeshArena *arena);
327 void remove_null_faces();
338 float3 max{-FLT_MAX, -FLT_MAX, -FLT_MAX};
345 void combine(
const float3 &p)
375 void expand(
float pad)
405 IMesh trimesh_self_intersect(
const IMesh &tm_in, IMeshArena *arena);
407 IMesh trimesh_nary_intersect(
const IMesh &tm_in,
409 std::function<
int(
int)> shape_fn,
419 IMesh triangulate_polymesh(IMesh &imesh, IMeshArena *arena);
424 void write_obj_mesh(IMesh &m,
const std::string &objname);
MINLINE float max_ff(float a, float b)
MINLINE float min_ff(float a, float b)
int pad[32 - sizeof(int)]
ATTR_WARN_UNUSED_RESULT const BMVert * v
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
SIMD_FORCE_INLINE btVector3 & operator[](int i)
Get a mutable reference to a row of the matrix as a vector.
SIMD_FORCE_INLINE btScalar norm() const
Return the norm (length) of the vector.
std::ostream & operator<<(std::ostream &stream, const FatCo< T > &co)
constexpr bool operator==(StringRef a, StringRef b)
vec_base< double, 3 > double3
unsigned __int64 uint64_t