Skip to main content

DesignBlock

Struct DesignBlock 

Source
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

Source

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.

Source

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.

Source

pub fn select_mesh_nodes_inside( &self, target_mesh_nodes: &[[f64; 3]], ) -> Result<Vec<usize>>

Selects the node ids corresponding to the target mesh that fit inside the design block.

§Arguments
  • target_mesh_nodes: Mesh nodes to check.
§Returns

Node ids corresponding to free deformable Mesh nodes.

Source

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

Source§

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)

Performs copy-assignment from source. Read more
Source§

impl Debug for DesignBlock

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.