Browse Source

Revert "fix: Make get_identity_local_to_world virtual to support primitives with multiple subfaces (e.g., cylinder)."

This reverts commit f0e2d2b204fe749efb782922a068c067063121a4.
V2-origin
mckay 1 week ago
parent
commit
2046b9ba6a
  1. 4
      primitive_process/interface/base/primitive.hpp
  2. 9
      primitive_process/interface/primitive/simple/cylinder.hpp
  3. 5
      primitive_process/src/primitive/simple/cylinder.cpp

4
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);

9
primitive_process/interface/primitive/simple/cylinder.hpp

@ -16,15 +16,6 @@ struct cylinder_t final : primitive {
marked_subface_ptr_t<internal::plane_t> bottom_plane{};
marked_subface_ptr_t<internal::plane_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<std::pair<internal::paired_model_matrix *, bool>> &) override;

5
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
Loading…
Cancel
Save