pub struct DesignBlock {
pub nodes: Vec<[f64; 3]>,
pub length: [f64; 3],
pub centre: [f64; 3],
pub theta: [f64; 3],
pub resolution: [usize; 3],
pub corner_nodes: [[f64; 3]; 8],
pub scaling_factors: [f64; 3],
pub local_coordinate_system: [[f64; 3]; 4],
}Expand description
DesignBlock represents a geometric block in 3D space.
§Arguments
nodes: A vector of nodes (or points) inside the block, each represented by a[f64; 3]array.length: The lengths of the block in the x, y, and z directions as a[f64; 3]array.centre: The coordinates of the center of the block as a[f64; 3]array.theta: The angles (in radians) to rotate the block around the x, y, and z axes as a[f64; 3]array.resolution: The resolution of the block in each dimension, represented as a[usize; 3]array.corner_nodes: The 8 corner in x, y, and z directions as a[[f64; 3]; 8]array.scaling_factors: The scaling factors in x, y, and z directions as a[f64; 3]array.local_coordinate_system: A 4x3 array defining the local coordinate system of the block.
Fields§
§nodes: Vec<[f64; 3]>§length: [f64; 3]§centre: [f64; 3]§theta: [f64; 3]§resolution: [usize; 3]§corner_nodes: [[f64; 3]; 8]§scaling_factors: [f64; 3]§local_coordinate_system: [[f64; 3]; 4]Implementations§
Source§impl DesignBlock
impl DesignBlock
Sourcepub fn new(
length: [f64; 3],
centre: [f64; 3],
theta: [f64; 3],
resolution: [usize; 3],
) -> Result<Self>
pub fn new( length: [f64; 3], centre: [f64; 3], theta: [f64; 3], resolution: [usize; 3], ) -> Result<Self>
Creates a new DesignBlock instance.
§Arguments
length: The lengths of the block in the x, y, and z directions as a[f64; 3]array.centre: The coordinates of the center of the block as a[f64; 3]array.theta: The angles (in radians) to rotate the block around the x, y, and z axes as a[f64; 3]array.resolution: The resolution of the block in each dimension, represented as a[usize; 3]array.
§Returns
A new instance of DesignBlock.
Sourcepub fn select_free_design_nodes(
&self,
target_mesh: &Mesh,
fixed_layers: Option<usize>,
) -> Result<Vec<usize>>
pub fn select_free_design_nodes( &self, target_mesh: &Mesh, fixed_layers: Option<usize>, ) -> Result<Vec<usize>>
Selects free deformable control nodes by checking intersection with a mesh body.
§Arguments
target_mesh: Mesh to check intersections with.fixed_layers: How many layers to exclude from the intersection, for instance quadratic=2, linear=1.
§Returns
Node ids corresponding to free deformable DesignBlock nodes.
Sourcepub fn select_mesh_nodes_inside(
&self,
target_mesh_nodes: &[[f64; 3]],
) -> Result<Vec<usize>>
pub fn select_mesh_nodes_inside( &self, target_mesh_nodes: &[[f64; 3]], ) -> Result<Vec<usize>>
Sourcepub fn transform_subset(
&self,
node_ids: &[usize],
transform_matrix: &[[f64; 4]; 4],
pivot: &[f64; 3],
) -> Vec<[f64; 3]>
pub fn transform_subset( &self, node_ids: &[usize], transform_matrix: &[[f64; 4]; 4], pivot: &[f64; 3], ) -> Vec<[f64; 3]>
Creates a new set of nodes by applying a transformation to a subset of the original nodes.
§Arguments
node_ids: A slice of indices corresponding to the control points to be transformed.transform_matrix: The 4x4 affine transformation matrix to apply.pivot: The point around which the transformation (like rotation) should occur.
§Returns
A new Vec<[f64; 3]> containing the full set of nodes with the specified subset transformed.
Trait Implementations§
Source§impl Clone for DesignBlock
impl Clone for DesignBlock
Source§fn clone(&self) -> DesignBlock
fn clone(&self) -> DesignBlock
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for DesignBlock
impl RefUnwindSafe for DesignBlock
impl Send for DesignBlock
impl Sync for DesignBlock
impl Unpin for DesignBlock
impl UnsafeUnpin for DesignBlock
impl UnwindSafe for DesignBlock
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more