pub struct SlicePlane { /* private fields */ }Expand description
A slice plane that can cut through geometry.
The plane is defined by a point (origin) and a normal direction. Geometry on the negative side of the plane (opposite to normal) is discarded.
Implementations§
Source§impl SlicePlane
impl SlicePlane
Sourcepub fn new(name: impl Into<String>) -> Self
pub fn new(name: impl Into<String>) -> Self
Creates a new slice plane with default settings.
By default, the plane is at the origin with +Y normal.
Sourcepub fn with_pose(name: impl Into<String>, origin: Vec3, normal: Vec3) -> Self
pub fn with_pose(name: impl Into<String>, origin: Vec3, normal: Vec3) -> Self
Creates a slice plane with specific pose.
Sourcepub fn set_origin(&mut self, origin: Vec3)
pub fn set_origin(&mut self, origin: Vec3)
Sets the origin point of the plane.
Sourcepub fn set_normal(&mut self, normal: Vec3)
pub fn set_normal(&mut self, normal: Vec3)
Sets the normal direction of the plane.
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Returns whether the slice plane is enabled.
Sourcepub fn set_enabled(&mut self, enabled: bool)
pub fn set_enabled(&mut self, enabled: bool)
Sets whether the slice plane is enabled.
Sourcepub fn draw_plane(&self) -> bool
pub fn draw_plane(&self) -> bool
Returns whether to draw the plane visualization.
Sourcepub fn set_draw_plane(&mut self, draw: bool)
pub fn set_draw_plane(&mut self, draw: bool)
Sets whether to draw the plane visualization.
Sourcepub fn draw_widget(&self) -> bool
pub fn draw_widget(&self) -> bool
Returns whether to draw the widget.
Sourcepub fn set_draw_widget(&mut self, draw: bool)
pub fn set_draw_widget(&mut self, draw: bool)
Sets whether to draw the widget.
Sourcepub fn transparency(&self) -> f32
pub fn transparency(&self) -> f32
Returns the transparency of the plane visualization.
Sourcepub fn set_transparency(&mut self, transparency: f32)
pub fn set_transparency(&mut self, transparency: f32)
Sets the transparency of the plane visualization.
Sourcepub fn plane_size(&self) -> f32
pub fn plane_size(&self) -> f32
Returns the size of the plane visualization (half-extent in each direction).
Sourcepub fn set_plane_size(&mut self, size: f32)
pub fn set_plane_size(&mut self, size: f32)
Sets the size of the plane visualization (half-extent in each direction).
Sourcepub fn signed_distance(&self, point: Vec3) -> f32
pub fn signed_distance(&self, point: Vec3) -> f32
Returns the signed distance from a point to the plane.
Positive values are on the normal side (kept), negative on the opposite (discarded).
Sourcepub fn is_kept(&self, point: Vec3) -> bool
pub fn is_kept(&self, point: Vec3) -> bool
Returns whether a point is on the kept side of the plane.
Sourcepub fn to_transform(&self) -> Mat4
pub fn to_transform(&self) -> Mat4
Computes a transform matrix for gizmo manipulation.
The plane normal becomes the local X axis, with Y and Z axes forming an orthonormal basis in the plane.
Sourcepub fn set_from_transform(&mut self, transform: Mat4)
pub fn set_from_transform(&mut self, transform: Mat4)
Updates origin and normal from a transform matrix.
Extracts position from column 3 (translation), and normal from column 0 (x-axis in local space).
Trait Implementations§
Source§impl Clone for SlicePlane
impl Clone for SlicePlane
Source§fn clone(&self) -> SlicePlane
fn clone(&self) -> SlicePlane
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more