pub struct PrimitiveScene {
pub points: Vec<(Vector3, Color10)>,
pub lines: Vec<([Vector3; 2], Color10)>,
pub triangles: Vec<(TriangleFace, Color10)>,
pub triangles_transparent: Vec<(TriangleFace, Color10, f64)>,
pub labels: Vec<(Vector3, String, Color10)>,
pub cylinders: Vec<(Vector3, Vector3, f64, Color10)>,
}Fields§
§points: Vec<(Vector3, Color10)>§lines: Vec<([Vector3; 2], Color10)>Line segments, as their two ends.
triangles: Vec<(TriangleFace, Color10)>§triangles_transparent: Vec<(TriangleFace, Color10, f64)>Triangles rendered with alpha blending (color, opacity in
[0, 1]) — e.g. so a face’s fill doesn’t hide the trim curves,
vertices or labels drawn on top of/behind it.
labels: Vec<(Vector3, String, Color10)>Text labels anchored at a 3-D world position (e.g. an entity’s id),
rendered as always-facing-camera HTML overlays via CSS2DRenderer.
cylinders: Vec<(Vector3, Vector3, f64, Color10)>Thick tubes (start, end, radius, color) — e.g. coordinate
system axes, rendered as solid geometry instead of a Line, since a
THREE.Line’s width can’t be controlled portably across GPUs.
Implementations§
Source§impl PrimitiveScene
impl PrimitiveScene
pub fn new() -> Self
pub fn add_point(&mut self, p: Vector3, c: Color10)
Sourcepub fn add_polyline(&mut self, points: &[Vector3], color: Color10)
pub fn add_polyline(&mut self, points: &[Vector3], color: Color10)
Draw an already-sampled polyline as n - 1 line segments, skipping
any between consecutive points that could coincide.
pub fn add_triangle(&mut self, t: TriangleFace, c: Color10)
Sourcepub fn add_triangle_transparent(
&mut self,
t: TriangleFace,
c: Color10,
opacity: f64,
)
pub fn add_triangle_transparent( &mut self, t: TriangleFace, c: Color10, opacity: f64, )
Add a triangle rendered with alpha blending — opacity in [0, 1]
(0 invisible, 1 opaque).
Sourcepub fn add_label(&mut self, pos: Vector3, text: impl Into<String>, c: Color10)
pub fn add_label(&mut self, pos: Vector3, text: impl Into<String>, c: Color10)
Add a text label anchored at pos in world space — rendered as an
always-facing-camera HTML overlay, colored c.
Sourcepub fn add_cylinder(
&mut self,
start: Vector3,
end: Vector3,
radius: f64,
c: Color10,
)
pub fn add_cylinder( &mut self, start: Vector3, end: Vector3, radius: f64, c: Color10, )
Add a solid cylindrical tube from start to end, radius wide —
e.g. for drawing thick axes/arrows that stay visibly wide regardless
of GPU line-width support.
Sourcepub fn add_curve(
&mut self,
curve: &NurbCurve3D,
t_min: Scalar,
t_max: Scalar,
color: Color10,
n: usize,
) -> GeopResult<()>
pub fn add_curve( &mut self, curve: &NurbCurve3D, t_min: Scalar, t_max: Scalar, color: Color10, n: usize, ) -> GeopResult<()>
Rasterize a curve: n uniform samples → n-1 line segments.
Sourcepub fn add_surface_wireframe(
&mut self,
surface: &NurbSurface3D,
color: Color10,
u_min: Scalar,
u_max: Scalar,
v_min: Scalar,
v_max: Scalar,
n: usize,
) -> GeopResult<()>
pub fn add_surface_wireframe( &mut self, surface: &NurbSurface3D, color: Color10, u_min: Scalar, u_max: Scalar, v_min: Scalar, v_max: Scalar, n: usize, ) -> GeopResult<()>
Wireframe: n×n grid of quads emitted as line segments.
Sourcepub fn save_to_file(&self, filename: &str) -> GeopResult<()>
pub fn save_to_file(&self, filename: &str) -> GeopResult<()>
Write a self-contained HTML file with an embedded three.js scene.