pub struct Scope {
pub position: Vec3,
pub rotation: Quat,
pub size: Vec3,
}Expand description
An Oriented Bounding Box (OBB) that defines a shape’s coordinate frame.
Every CGA operation transforms a parent Scope into one or more child Scopes.
position: world-space location of the scope’s local-space origin — the(0, 0, 0)corner of the box, not its centre. World corners are obtained asposition + rotation * (u·sx, v·sy, w·sz)with each coordinate in[0, 1](seeScope::world_point).rotation: local-to-world orientation (unit quaternion required byScope::validate).size: non-negative extents along the local X, Y, Z axes. Zero on a given axis is allowed (footprint scopes havesize.y = 0untilExtruderuns; face scopes fromComp(Faces)carrysize.z = 0).
Fields§
§position: Vec3§rotation: Quat§size: Vec3Implementations§
Source§impl Scope
impl Scope
pub fn new(position: Vec3, rotation: Quat, size: Vec3) -> Self
Sourcepub fn validate(&self) -> Result<(), ShapeError>
pub fn validate(&self) -> Result<(), ShapeError>
Returns Ok(()) if all fields are finite, the rotation is a unit quaternion,
and no size component is negative.
Zero size components are permitted: a root scope may have Y = 0 before
Extrude sets its height, and face scopes produced by Comp(Faces) carry
Z = 0 (they are 2-D canvases). Negative sizes, however, have no valid
interpretation and are rejected here before they can silently corrupt
downstream operations such as Split.
Returns Err(InvalidNumericValue) on any violation.
Trait Implementations§
impl Copy for Scope
Source§impl<'de> Deserialize<'de> for Scope
impl<'de> Deserialize<'de> for Scope
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Scope
Auto Trait Implementations§
impl Freeze for Scope
impl RefUnwindSafe for Scope
impl Send for Scope
impl Sync for Scope
impl Unpin for Scope
impl UnsafeUnpin for Scope
impl UnwindSafe for Scope
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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