From 2046b9ba6a5c33e5f6b941b2c0f77b8858ade00b Mon Sep 17 00:00:00 2001 From: mckay Date: Thu, 4 Sep 2025 13:45:39 +0800 Subject: [PATCH] Revert "fix: Make get_identity_local_to_world virtual to support primitives with multiple subfaces (e.g., cylinder)." This reverts commit f0e2d2b204fe749efb782922a068c067063121a4. --- primitive_process/interface/base/primitive.hpp | 4 +--- .../interface/primitive/simple/cylinder.hpp | 9 --------- primitive_process/src/primitive/simple/cylinder.cpp | 5 ----- 3 files changed, 1 insertion(+), 17 deletions(-) diff --git a/primitive_process/interface/base/primitive.hpp b/primitive_process/interface/base/primitive.hpp index 622b5e2..b0cf6e1 100644 --- a/primitive_process/interface/base/primitive.hpp +++ b/primitive_process/interface/base/primitive.hpp @@ -62,9 +62,7 @@ EXTERN_C struct PE_API primitive { // so we don't need to fetch aabb anymore // aabb fetch_aabb() const; // CAUTION: keep characteristics local_to_world as the first subface's part - // why virtual? for special primitive like cylinder, it may have multiple parts, the part - // with index 0 may not be the identity transform. e.g., cylinder face has no z translation. - virtual const internal::transform_block &get_identity_local_to_world() const; + const internal::transform_block &get_identity_local_to_world() const; void apply_transform(internal::transform_type, Eigen::Vector4d); diff --git a/primitive_process/interface/primitive/simple/cylinder.hpp b/primitive_process/interface/primitive/simple/cylinder.hpp index 20d6ac5..0f42e37 100644 --- a/primitive_process/interface/primitive/simple/cylinder.hpp +++ b/primitive_process/interface/primitive/simple/cylinder.hpp @@ -16,15 +16,6 @@ struct cylinder_t final : primitive { marked_subface_ptr_t bottom_plane{}; marked_subface_ptr_t top_plane{}; - // why virtual? For special primitives like cylinder, it may have multiple parts. - // The part with index 0 may not be the identity transform. - // For example, the cylinder face has no z translation. - // Note: The AABB of a cylinder is defined by the side surface, and z-axis scaling does not affect the side surface's radius. - // The degeneracy (simplification) check for a cylinder only considers the first two rows of the transform matrix (x/y directions), - // because scaling along z does not change the essential geometry of the cylinder side surface. - // TODO: the better way is to redefine cylinder, make identity transform as the first part. - const internal::transform_block &get_identity_local_to_world() const override; - protected: void initialize(primitive_data_center_t &, const std::vector> &) override; diff --git a/primitive_process/src/primitive/simple/cylinder.cpp b/primitive_process/src/primitive/simple/cylinder.cpp index 593e02d..20623a6 100644 --- a/primitive_process/src/primitive/simple/cylinder.cpp +++ b/primitive_process/src/primitive/simple/cylinder.cpp @@ -61,9 +61,4 @@ void cylinder_t::initialize(primitive_data_center_t data_center.planes.release(plane_paired_model_matrix{old_model_matrices[2]}); } } - -const internal::transform_block &cylinder_t::get_identity_local_to_world() const -{ - return get_subface()[1].get_ptr()->raw_local_to_world(); -} } // namespace internal \ No newline at end of file