pub struct Viewer { /* private fields */ }Expand description
Viewer struct is used to view points, edges, and curves in OpenSCAD.
Implementations§
Source§impl Viewer
impl Viewer
Sourcepub fn new(point_radius: f64, edge_radius: f64, segments: u64) -> Self
pub fn new(point_radius: f64, edge_radius: f64, segments: u64) -> Self
Examples found in repository?
examples/view_cubic_bezier_chain.rs (line 42)
32fn main() {
33 let mut curve = dim2::CubicBezierChain2D::new(
34 Pt2::new(0.0, 0.0),
35 Pt2::new(40.0, -20.0),
36 Pt2::new(40.0, 80.0),
37 Pt2::new(0.0, 40.0),
38 24,
39 );
40 curve.add(20.0, Pt2::new(-30.0, 50.0), Pt2::new(-50.0, 40.0), 12);
41
42 let mut viewer = Viewer::new(0.5, 0.25, 6);
43 viewer.add_cubic_bezier_chain2d(&curve);
44 scad_file!(32, "output/view_cubic_bezier_chain.scad",
45 viewer.into_scad();
46 );
47}More examples
examples/bezier_star_sweep.rs (line 44)
38fn main() {
39 let output_viewer = false;
40 let path = BezierStar::new(7, 20.0, 9.0, 40.0, 15.0, 12);
41 let profile = BezierStar::new(7, 2.0, 0.9, 4.0, 1.5, 12);
42
43 if output_viewer {
44 let mut viewer = Viewer::new(0.5, 0.25, 6);
45 viewer.add_bezier_star(&path);
46 let mut small_viewer = Viewer::new(0.05, 0.025, 6);
47 small_viewer.add_bezier_star(&profile);
48 scad_file!(32, "output/bezier_star_sweep.scad",
49 small_viewer.into_scad() + viewer.into_scad();
50 );
51 } else {
52 let path = Pt3s::from_pt3s(path.gen_points().iter().map(|p| p.as_pt3(0.0)).collect());
53 let profile = profile.gen_points();
54 let star_swept = Polyhedron::sweep(&profile, &path, 7.0 * 360.0, true);
55 scad_file!(32, "output/bezier_star_sweep.scad",
56 star_swept.into_scad();
57 );
58 }
59}pub fn add_pt2(&mut self, point: Pt2, color: ScadColor)
pub fn add_pt3(&mut self, point: Pt3, color: ScadColor)
pub fn add_pt2s(&mut self, points: &Pt2s, color: ScadColor)
pub fn add_pt3s(&mut self, points: &Pt3s, color: ScadColor)
pub fn add_lines2d(&mut self, edges: &Vec<(Pt2, Pt2)>, color: ScadColor)
pub fn add_lines3d(&mut self, edges: &Vec<(Pt3, Pt3)>, color: ScadColor)
pub fn add_quadratic_bezier2d(&mut self, curve: &QuadraticBezier2D)
pub fn add_quadratic_bezier3d(&mut self, curve: &QuadraticBezier3D)
pub fn add_cubic_bezier2d(&mut self, curve: &CubicBezier2D)
pub fn add_cubic_bezier3d(&mut self, curve: &CubicBezier3D)
Sourcepub fn add_cubic_bezier_chain2d(&mut self, curve: &CubicBezierChain2D)
pub fn add_cubic_bezier_chain2d(&mut self, curve: &CubicBezierChain2D)
Examples found in repository?
examples/view_cubic_bezier_chain.rs (line 43)
32fn main() {
33 let mut curve = dim2::CubicBezierChain2D::new(
34 Pt2::new(0.0, 0.0),
35 Pt2::new(40.0, -20.0),
36 Pt2::new(40.0, 80.0),
37 Pt2::new(0.0, 40.0),
38 24,
39 );
40 curve.add(20.0, Pt2::new(-30.0, 50.0), Pt2::new(-50.0, 40.0), 12);
41
42 let mut viewer = Viewer::new(0.5, 0.25, 6);
43 viewer.add_cubic_bezier_chain2d(&curve);
44 scad_file!(32, "output/view_cubic_bezier_chain.scad",
45 viewer.into_scad();
46 );
47}pub fn add_cubic_bezier_chain3d(&mut self, curve: &CubicBezierChain3D)
Sourcepub fn add_bezier_star(&mut self, star: &BezierStar)
pub fn add_bezier_star(&mut self, star: &BezierStar)
Examples found in repository?
examples/bezier_star_sweep.rs (line 45)
38fn main() {
39 let output_viewer = false;
40 let path = BezierStar::new(7, 20.0, 9.0, 40.0, 15.0, 12);
41 let profile = BezierStar::new(7, 2.0, 0.9, 4.0, 1.5, 12);
42
43 if output_viewer {
44 let mut viewer = Viewer::new(0.5, 0.25, 6);
45 viewer.add_bezier_star(&path);
46 let mut small_viewer = Viewer::new(0.05, 0.025, 6);
47 small_viewer.add_bezier_star(&profile);
48 scad_file!(32, "output/bezier_star_sweep.scad",
49 small_viewer.into_scad() + viewer.into_scad();
50 );
51 } else {
52 let path = Pt3s::from_pt3s(path.gen_points().iter().map(|p| p.as_pt3(0.0)).collect());
53 let profile = profile.gen_points();
54 let star_swept = Polyhedron::sweep(&profile, &path, 7.0 * 360.0, true);
55 scad_file!(32, "output/bezier_star_sweep.scad",
56 star_swept.into_scad();
57 );
58 }
59}Sourcepub fn into_scad(self) -> Scad
pub fn into_scad(self) -> Scad
Examples found in repository?
examples/view_cubic_bezier_chain.rs (line 45)
32fn main() {
33 let mut curve = dim2::CubicBezierChain2D::new(
34 Pt2::new(0.0, 0.0),
35 Pt2::new(40.0, -20.0),
36 Pt2::new(40.0, 80.0),
37 Pt2::new(0.0, 40.0),
38 24,
39 );
40 curve.add(20.0, Pt2::new(-30.0, 50.0), Pt2::new(-50.0, 40.0), 12);
41
42 let mut viewer = Viewer::new(0.5, 0.25, 6);
43 viewer.add_cubic_bezier_chain2d(&curve);
44 scad_file!(32, "output/view_cubic_bezier_chain.scad",
45 viewer.into_scad();
46 );
47}More examples
examples/bezier_star_sweep.rs (line 49)
38fn main() {
39 let output_viewer = false;
40 let path = BezierStar::new(7, 20.0, 9.0, 40.0, 15.0, 12);
41 let profile = BezierStar::new(7, 2.0, 0.9, 4.0, 1.5, 12);
42
43 if output_viewer {
44 let mut viewer = Viewer::new(0.5, 0.25, 6);
45 viewer.add_bezier_star(&path);
46 let mut small_viewer = Viewer::new(0.05, 0.025, 6);
47 small_viewer.add_bezier_star(&profile);
48 scad_file!(32, "output/bezier_star_sweep.scad",
49 small_viewer.into_scad() + viewer.into_scad();
50 );
51 } else {
52 let path = Pt3s::from_pt3s(path.gen_points().iter().map(|p| p.as_pt3(0.0)).collect());
53 let profile = profile.gen_points();
54 let star_swept = Polyhedron::sweep(&profile, &path, 7.0 * 360.0, true);
55 scad_file!(32, "output/bezier_star_sweep.scad",
56 star_swept.into_scad();
57 );
58 }
59}Auto Trait Implementations§
impl Freeze for Viewer
impl RefUnwindSafe for Viewer
impl Send for Viewer
impl Sync for Viewer
impl Unpin for Viewer
impl UnwindSafe for Viewer
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