pub struct Segment { /* private fields */ }Expand description
Line segment geometry in local shape space.
Implementations§
Source§impl Segment
impl Segment
pub fn new<P1: Into<Vec2>, P2: Into<Vec2>>( point1: P1, point2: P2, ) -> Result<Self>
Sourcepub fn from_raw(raw: b2Segment) -> Result<Self>
pub fn from_raw(raw: b2Segment) -> Result<Self>
Construct from a raw Box2D geometry value after validating its invariants.
pub const fn point1(self) -> Vec2
pub const fn point2(self) -> Vec2
Sourcepub fn is_valid(self) -> bool
pub fn is_valid(self) -> bool
Validate this segment for safe Box2D shape and standalone collision use.
Sourcepub fn validate(self) -> Result<()>
pub fn validate(self) -> Result<()>
Validate this segment for safe Box2D shape and standalone collision use.
Sourcepub fn aabb(self, transform: WorldTransform) -> Result<Aabb>
pub fn aabb(self, transform: WorldTransform) -> Result<Aabb>
Compute an absolute world-space AABB using transform as the segment’s
local-to-world transform.
The result uses f32 coordinates in both precision modes. Double-precision world bounds
are narrowed outward by Box2D so the returned AABB remains conservative.
pub fn ray_cast<VO: Into<Vec2>, VT: Into<Vec2>>( self, origin: VO, translation: VT, one_sided: bool, ) -> Result<CastOutput>
pub fn shape_cast(self, input: ShapeCastInput) -> Result<CastOutput>
Trait Implementations§
impl Copy for Segment
impl StructuralPartialEq for Segment
Auto Trait Implementations§
impl Freeze for Segment
impl RefUnwindSafe for Segment
impl Send for Segment
impl Sync for Segment
impl Unpin for Segment
impl UnsafeUnpin for Segment
impl UnwindSafe for Segment
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