pub struct PrimitiveScene<S: Scalar> {
pub points: Vec<(Vector3<S>, Color10)>,
pub lines: Vec<(Line<S>, Color10)>,
pub highlight_lines: Vec<(Line<S>, Color10)>,
pub triangles: Vec<(TriangleFace<S>, Color10)>,
pub triangles_rgb: Vec<(TriangleFace<S>, Color10, Color10, Color10)>,
pub triangles_transparent: Vec<(TriangleFace<S>, Color10, f64)>,
pub labels: Vec<(Vector3<S>, String, Color10)>,
pub cylinders: Vec<(Vector3<S>, Vector3<S>, f64, Color10)>,
pub debug_text: String,
/* private fields */
}Fields§
§points: Vec<(Vector3<S>, Color10)>§lines: Vec<(Line<S>, Color10)>§highlight_lines: Vec<(Line<S>, Color10)>Like lines, but rendered with depth-testing disabled (and after
everything else), so they stay visible on top of solid triangles
instead of being occluded — useful for highlighting intersection
curves on a solid (non-wireframe) render.
triangles: Vec<(TriangleFace<S>, Color10)>§triangles_rgb: Vec<(TriangleFace<S>, Color10, Color10, Color10)>Triangles with an independent color per vertex (a, b, c),
interpolated across the face — useful for telling the three corners
of a debug triangle apart at a glance.
triangles_transparent: Vec<(TriangleFace<S>, 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<S>, 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<S>, Vector3<S>, 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.
debug_text: StringImplementations§
Source§impl<S: Scalar> PrimitiveScene<S>
impl<S: Scalar> PrimitiveScene<S>
pub fn new() -> Self
pub fn add_point(&mut self, p: Vector3<S>, c: Color10)
pub fn add_line(&mut self, l: Line<S>, c: Color10)
Sourcepub fn add_polyline(&mut self, points: &[Vector3<S>], color: Color10)
pub fn add_polyline(&mut self, points: &[Vector3<S>], color: Color10)
Draw an already-sampled polyline as n - 1 line segments, skipping
any consecutive pair of (near-)coincident points.
Sourcepub fn add_highlight_line(&mut self, l: Line<S>, c: Color10)
pub fn add_highlight_line(&mut self, l: Line<S>, c: Color10)
Like add_line, but drawn with depth-testing disabled — see
highlight_lines’s doc comment.
Sourcepub fn add_highlight_polyline(&mut self, points: &[Vector3<S>], color: Color10)
pub fn add_highlight_polyline(&mut self, points: &[Vector3<S>], color: Color10)
Like add_polyline, but drawn with depth-testing disabled — see
highlight_lines’s doc comment.
pub fn add_triangle(&mut self, t: TriangleFace<S>, c: Color10)
Sourcepub fn add_triangle_rgb(
&mut self,
t: TriangleFace<S>,
ca: Color10,
cb: Color10,
cc: Color10,
)
pub fn add_triangle_rgb( &mut self, t: TriangleFace<S>, ca: Color10, cb: Color10, cc: Color10, )
Add a triangle with an independent color per vertex (t.a → ca,
t.b → cb, t.c → cc), interpolated across the face.
Sourcepub fn add_triangle_transparent(
&mut self,
t: TriangleFace<S>,
c: Color10,
opacity: f64,
)
pub fn add_triangle_transparent( &mut self, t: TriangleFace<S>, 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<S>,
text: impl Into<String>,
c: Color10,
)
pub fn add_label( &mut self, pos: Vector3<S>, 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<S>,
end: Vector3<S>,
radius: f64,
c: Color10,
)
pub fn add_cylinder( &mut self, start: Vector3<S>, end: Vector3<S>, 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.
pub fn add_scene(&mut self, other: PrimitiveScene<S>)
pub fn set_debug_text(&mut self, text: String)
pub fn add_debug_text(&mut self, text: String)
Sourcepub fn add_curve(
&mut self,
curve: &dyn RasterizableCurve<S>,
t_min: S,
t_max: S,
color: Color10,
n: usize,
) -> GeopResult<()>
pub fn add_curve( &mut self, curve: &dyn RasterizableCurve<S>, t_min: S, t_max: S, color: Color10, n: usize, ) -> GeopResult<()>
Rasterize a curve: n uniform samples → n-1 line segments.
Sourcepub fn add_surface(
&mut self,
surface: &dyn RasterizableSurface<S>,
color: Color10,
u_min: S,
u_max: S,
v_min: S,
v_max: S,
n: usize,
) -> GeopResult<()>
pub fn add_surface( &mut self, surface: &dyn RasterizableSurface<S>, color: Color10, u_min: S, u_max: S, v_min: S, v_max: S, n: usize, ) -> GeopResult<()>
Rasterize a surface: n×n quad grid → 2n² triangles.
Sourcepub fn add_surface_wireframe(
&mut self,
surface: &dyn RasterizableSurface<S>,
color: Color10,
u_min: S,
u_max: S,
v_min: S,
v_max: S,
n: usize,
) -> GeopResult<()>
pub fn add_surface_wireframe( &mut self, surface: &dyn RasterizableSurface<S>, color: Color10, u_min: S, u_max: S, v_min: S, v_max: S, n: usize, ) -> GeopResult<()>
Wireframe: n×n grid of quads emitted as line segments.
Sourcepub fn is_watertight(&self, eps: f64) -> Result<(), String>
pub fn is_watertight(&self, eps: f64) -> Result<(), String>
Check that self.triangles forms a watertight (closed, 2-manifold)
mesh: every triangle edge, quantized to a grid of size eps and
identified regardless of direction, must be shared by exactly 2
triangles.
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.