[][src]Trait mgf::Shape

pub trait Shape: AddAssign<Vector3<f32>> + SubAssign<Vector3<f32>> {
    fn center(&self) -> Point3<f32>;
fn closest_point(&self, to: Point3<f32>) -> Point3<f32>; fn set_pos(&mut self, p: Point3<f32>) { ... } }

A type that describes a set of points in space.

Shape is usually used to describe static static objects such as a regular Sphere or Capsule. It allows for these shapes to be decomposed into some arbitrary center point and displaced by Vectors.

Required methods

fn center(&self) -> Point3<f32>

Returns the center of mass of the geometry, assuming a regular density.

fn closest_point(&self, to: Point3<f32>) -> Point3<f32>

Returns the closest point on the shape to the given point.

Loading content...

Provided methods

fn set_pos(&mut self, p: Point3<f32>)

Sets the center of the shape to p.

Loading content...

Implementors

impl Shape for Component[src]

impl Shape for AABB[src]

impl Shape for Capsule[src]

impl Shape for Compound[src]

fn center(&self) -> Point3<f32>[src]

The point returned by a compound shape is the displacement of the object and not the center of mass. It is impossible for Compound to calculate the center of mass given it has no information regarding the mass of individual components.

impl Shape for ConvexMesh[src]

impl Shape for Mesh[src]

impl Shape for OBB[src]

impl Shape for Plane[src]

fn center(&self) -> Point3<f32>[src]

Conceptually, it's hard to consider any point of a plane the "center".

impl Shape for Ray[src]

impl Shape for Rectangle[src]

impl Shape for Segment[src]

impl Shape for Sphere[src]

impl Shape for Triangle[src]

Loading content...