31constexpr int NO_INDEX = -1;
55 Vert(
const mpq3 &mco,
const double3 &dco,
int id,
int orig);
81 Plane(
const mpq3 &norm_exact,
const mpq_class &d_exact);
82 Plane(
const double3 &
norm,
double d);
90 void make_canonical();
94 bool exact_populated()
const;
95 void populate_exact();
98std::ostream &
operator<<(std::ostream &os,
const Plane *plane);
116struct Face : NonCopyable {
117 Array<const Vert *> vert;
118 Array<int> edge_orig;
119 Array<bool> is_intersect;
120 Plane *plane =
nullptr;
127 Face(Span<const Vert *>
verts,
int id,
int orig, Span<int> edge_origs, Span<bool> is_intersect);
128 Face(Span<const Vert *>
verts,
int id,
int orig);
133 return vert.size() == 3;
140 bool cyclic_equal(
const Face &other)
const;
142 FacePos next_pos(FacePos p)
const
144 return (p + 1) % vert.size();
147 FacePos prev_pos(FacePos p)
const
149 return (p + vert.size() - 1) % vert.size();
162 const Vert *
const *begin()
const
167 const Vert *
const *end()
const
172 IndexRange index_range()
const
174 return IndexRange(vert.size());
177 void populate_plane(
bool need_exact);
179 bool plane_populated()
const
181 return plane !=
nullptr;
185std::ostream &
operator<<(std::ostream &os,
const Face *f);
194class IMeshArena : NonCopyable, NonMovable {
195 class IMeshArenaImpl;
196 std::unique_ptr<IMeshArenaImpl> pimpl_;
206 void reserve(
int vert_num_hint,
int face_num_hint);
208 int tot_allocated_verts()
const;
209 int tot_allocated_faces()
const;
217 const Vert *add_or_find_vert(
const mpq3 &co,
int orig);
218 const Vert *add_or_find_vert(
const double3 &co,
int orig);
219 const Vert *add_or_find_vert(
Vert *vert);
221 Face *add_face(Span<const Vert *>
verts,
223 Span<int> edge_origs,
224 Span<bool> is_intersect);
225 Face *add_face(Span<const Vert *>
verts,
int orig, Span<int> edge_origs);
226 Face *add_face(Span<const Vert *>
verts,
int orig);
229 const Vert *find_vert(
const mpq3 &co)
const;
230 const Face *find_face(Span<const Vert *>
verts)
const;
245 Array<const Vert *> vert_;
246 Map<const Vert *, int> vert_to_index_;
247 bool vert_populated_ =
false;
251 IMesh(Span<Face *> faces) : face_(faces) {}
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();
330std::ostream &
operator<<(std::ostream &os,
const IMesh &mesh);
343 void combine(
const float3 &p)
348 void combine(
const double3 &p)
359 void expand(
float pad)
385IMesh trimesh_self_intersect(
const IMesh &tm_in, IMeshArena *arena);
387IMesh trimesh_nary_intersect(
const IMesh &tm_in,
389 FunctionRef<
int(
int)> shape_fn,
399IMesh triangulate_polymesh(IMesh &imesh, IMeshArena *arena);
404void write_obj_mesh(IMesh &m,
const std::string &objname);
bool operator==(const AssetWeakReference &a, const AssetWeakReference &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.
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
struct BoundingBox { packed_float3 min; packed_float3 max;} BoundingBox
std::ostream & operator<<(std::ostream &stream, EulerOrder order)
T min(const T &a, const T &b)
void min_max(const T &value, T &min, T &max)
T max(const T &a, const T &b)
VecBase< double, 3 > double3
unsigned __int64 uint64_t