pub struct Visual<'a> {
pub name: Option<&'a str>,
pub xyz: [f64; 3],
pub rpy: [f64; 3],
pub geometry: Geometry,
pub material: Option<Material<'a>>,
}Expand description
One shape a link is drawn with.
The shape itself is the one thing a visual cannot default, so
Visual::new takes it and leaves the rest to ...
use phoxal_model::AssetId;
use phoxal_model::builder::{Link, Material, RobotBuilder, Visual};
use phoxal_model::structure::Geometry;
let robot = RobotBuilder::new("rover")
.link(Link {
name: "base_link",
visuals: vec![Visual {
material: Some(Material {
color: Some([0.2, 0.2, 0.2, 1.0]),
..Material::new("carbon")
}),
..Visual::new(Geometry::Mesh {
asset: AssetId::new("meshes/chassis.stl")?,
scale: None,
})
}],
..Link::default()
})
.build()?;
let base = robot.structure().link("base_link").expect("the stated link");
assert_eq!(base.visuals().len(), 1);Fields§
§name: Option<&'a str>The visual’s own name, when the structure gives it one.
xyz: [f64; 3]The shape’s offset from the link’s origin, in metres.
rpy: [f64; 3]The shape’s roll, pitch and yaw relative to the link, in radians.
geometry: GeometryThe shape itself.
material: Option<Material<'a>>How the shape is rendered, when the structure says.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Visual<'a>
impl<'a> RefUnwindSafe for Visual<'a>
impl<'a> Send for Visual<'a>
impl<'a> Sync for Visual<'a>
impl<'a> Unpin for Visual<'a>
impl<'a> UnsafeUnpin for Visual<'a>
impl<'a> UnwindSafe for Visual<'a>
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