Skip to main content

PrimitiveScene

Struct PrimitiveScene 

Source
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: String

Implementations§

Source§

impl<S: Scalar> PrimitiveScene<S>

Source

pub fn new() -> Self

Source

pub fn add_point(&mut self, p: Vector3<S>, c: Color10)

Source

pub fn add_line(&mut self, l: Line<S>, c: Color10)

Source

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.

Source

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.

Source

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.

Source

pub fn add_triangle(&mut self, t: TriangleFace<S>, c: Color10)

Source

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.

Source

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).

Source

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.

Source

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.

Source

pub fn add_scene(&mut self, other: PrimitiveScene<S>)

Source

pub fn set_debug_text(&mut self, text: String)

Source

pub fn add_debug_text(&mut self, text: String)

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn save_to_file(&self, filename: &str) -> GeopResult<()>

Write a self-contained HTML file with an embedded three.js scene.

Trait Implementations§

Source§

impl<S: Scalar> Debug for PrimitiveScene<S>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<S: Scalar> DebugContext for PrimitiveScene<S>

Source§

fn label(&self) -> &str

One-line label shown in the error chain display.
Source§

impl<S: Scalar> Default for PrimitiveScene<S>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<S> !Freeze for PrimitiveScene<S>

§

impl<S> RefUnwindSafe for PrimitiveScene<S>
where S: RefUnwindSafe,

§

impl<S> Send for PrimitiveScene<S>

§

impl<S> Sync for PrimitiveScene<S>

§

impl<S> Unpin for PrimitiveScene<S>
where S: Unpin,

§

impl<S> UnsafeUnpin for PrimitiveScene<S>

§

impl<S> UnwindSafe for PrimitiveScene<S>
where S: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.