Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenlib/intern/mesh_intersect.cc
| Show First 20 Lines • Show All 521 Lines • ▼ Show 20 Lines | # endif | ||||
| }; | }; | ||||
| }; | }; | ||||
| IMeshArena::IMeshArena() | IMeshArena::IMeshArena() | ||||
| { | { | ||||
| pimpl_ = std::make_unique<IMeshArenaImpl>(); | pimpl_ = std::make_unique<IMeshArenaImpl>(); | ||||
| } | } | ||||
| IMeshArena::~IMeshArena() | IMeshArena::~IMeshArena() = default; | ||||
| { | |||||
| } | |||||
| void IMeshArena::reserve(int vert_num_hint, int face_num_hint) | void IMeshArena::reserve(int vert_num_hint, int face_num_hint) | ||||
| { | { | ||||
| pimpl_->reserve(vert_num_hint, face_num_hint); | pimpl_->reserve(vert_num_hint, face_num_hint); | ||||
| } | } | ||||
| int IMeshArena::tot_allocated_verts() const | int IMeshArena::tot_allocated_verts() const | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 207 Lines • ▼ Show 20 Lines | |||||
| struct BoundingBox { | struct BoundingBox { | ||||
| float3 min{FLT_MAX, FLT_MAX, FLT_MAX}; | float3 min{FLT_MAX, FLT_MAX, FLT_MAX}; | ||||
| float3 max{-FLT_MAX, -FLT_MAX, -FLT_MAX}; | float3 max{-FLT_MAX, -FLT_MAX, -FLT_MAX}; | ||||
| BoundingBox() = default; | BoundingBox() = default; | ||||
| BoundingBox(const float3 &min, const float3 &max) : min(min), max(max) | BoundingBox(const float3 &min, const float3 &max) : min(min), max(max) | ||||
| { | { | ||||
| } | } | ||||
| BoundingBox(const BoundingBox &other) : min(other.min), max(other.max) | |||||
| { | |||||
| } | |||||
| BoundingBox(BoundingBox &&other) noexcept : min(std::move(other.min)), max(std::move(other.max)) | |||||
| { | |||||
| } | |||||
| ~BoundingBox() = default; | |||||
| BoundingBox operator=(const BoundingBox &other) | |||||
| { | |||||
| if (this != &other) { | |||||
| min = other.min; | |||||
| max = other.max; | |||||
| } | |||||
| return *this; | |||||
| } | |||||
| BoundingBox operator=(BoundingBox &&other) noexcept | |||||
| { | |||||
| min = std::move(other.min); | |||||
| max = std::move(other.max); | |||||
| return *this; | |||||
| } | |||||
| void combine(const float3 &p) | void combine(const float3 &p) | ||||
| { | { | ||||
| min.x = min_ff(min.x, p.x); | min.x = min_ff(min.x, p.x); | ||||
| min.y = min_ff(min.y, p.y); | min.y = min_ff(min.y, p.y); | ||||
| min.z = min_ff(min.z, p.z); | min.z = min_ff(min.z, p.z); | ||||
| max.x = max_ff(max.x, p.x); | max.x = max_ff(max.x, p.x); | ||||
| max.y = max_ff(max.y, p.y); | max.y = max_ff(max.y, p.y); | ||||
| ▲ Show 20 Lines • Show All 146 Lines • ▼ Show 20 Lines | class CoplanarCluster { | ||||
| BoundingBox bb_; | BoundingBox bb_; | ||||
| public: | public: | ||||
| CoplanarCluster() = default; | CoplanarCluster() = default; | ||||
| CoplanarCluster(int t, const BoundingBox &bb) | CoplanarCluster(int t, const BoundingBox &bb) | ||||
| { | { | ||||
| this->add_tri(t, bb); | this->add_tri(t, bb); | ||||
| } | } | ||||
| CoplanarCluster(const CoplanarCluster &other) : tris_(other.tris_), bb_(other.bb_) | |||||
| { | |||||
| } | |||||
| CoplanarCluster(CoplanarCluster &&other) noexcept | |||||
| : tris_(std::move(other.tris_)), bb_(std::move(other.bb_)) | |||||
| { | |||||
| } | |||||
| ~CoplanarCluster() = default; | |||||
| CoplanarCluster &operator=(const CoplanarCluster &other) | |||||
| { | |||||
| if (this != &other) { | |||||
| tris_ = other.tris_; | |||||
| bb_ = other.bb_; | |||||
| } | |||||
| return *this; | |||||
| } | |||||
| CoplanarCluster &operator=(CoplanarCluster &&other) noexcept | |||||
| { | |||||
| tris_ = std::move(other.tris_); | |||||
| bb_ = std::move(other.bb_); | |||||
| return *this; | |||||
| } | |||||
| /* Assume that caller knows this will not be a duplicate. */ | /* Assume that caller knows this will not be a duplicate. */ | ||||
| void add_tri(int t, const BoundingBox &bb) | void add_tri(int t, const BoundingBox &bb) | ||||
| { | { | ||||
| tris_.append(t); | tris_.append(t); | ||||
| bb_.combine(bb); | bb_.combine(bb); | ||||
| } | } | ||||
| int tot_tri() const | int tot_tri() const | ||||
| ▲ Show 20 Lines • Show All 99 Lines • ▼ Show 20 Lines | struct ITT_value { | ||||
| { | { | ||||
| } | } | ||||
| ITT_value(ITT_value_kind k, const mpq3 &p1) : p1(p1), kind(k) | ITT_value(ITT_value_kind k, const mpq3 &p1) : p1(p1), kind(k) | ||||
| { | { | ||||
| } | } | ||||
| ITT_value(ITT_value_kind k, const mpq3 &p1, const mpq3 &p2) : p1(p1), p2(p2), kind(k) | ITT_value(ITT_value_kind k, const mpq3 &p1, const mpq3 &p2) : p1(p1), p2(p2), kind(k) | ||||
| { | { | ||||
| } | } | ||||
| ITT_value(const ITT_value &other) | |||||
| : p1(other.p1), p2(other.p2), t_source(other.t_source), kind(other.kind) | |||||
| { | |||||
| } | |||||
| ITT_value(ITT_value &&other) noexcept | |||||
| : p1(std::move(other.p1)), | |||||
| p2(std::move(other.p2)), | |||||
| t_source(other.t_source), | |||||
| kind(other.kind) | |||||
| { | |||||
| } | |||||
| ~ITT_value() | |||||
| { | |||||
| } | |||||
| ITT_value &operator=(const ITT_value &other) | |||||
| { | |||||
| if (this != &other) { | |||||
| kind = other.kind; | |||||
| p1 = other.p1; | |||||
| p2 = other.p2; | |||||
| t_source = other.t_source; | |||||
| } | |||||
| return *this; | |||||
| } | |||||
| ITT_value &operator=(ITT_value &&other) noexcept | |||||
| { | |||||
| kind = other.kind; | |||||
| p1 = std::move(other.p1); | |||||
| p2 = std::move(other.p2); | |||||
| t_source = other.t_source; | |||||
| return *this; | |||||
| } | |||||
| }; | }; | ||||
| static std::ostream &operator<<(std::ostream &os, const ITT_value &itt); | static std::ostream &operator<<(std::ostream &os, const ITT_value &itt); | ||||
| /** | /** | ||||
| * Project a 3d vert to a 2d one by eliding proj_axis. This does not create | * Project a 3d vert to a 2d one by eliding proj_axis. This does not create | ||||
| * degeneracies as long as the projection axis is one where the corresponding | * degeneracies as long as the projection axis is one where the corresponding | ||||
| * component of the originating plane normal is non-zero. | * component of the originating plane normal is non-zero. | ||||
| ▲ Show 20 Lines • Show All 1,799 Lines • Show Last 20 Lines | |||||