truck-modeling 0.6.0

integrated modeling algorithms by geometry and topology
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//! Modeling a sphere
//!
//! Generated json file can be visualized by `simple-shape-viewer`, an example of `truck-rendimpl`.

use std::f64::consts::PI;
use truck_modeling::*;

fn main() {
    let v0 = builder::vertex(Point3::new(0.0, 0.5, 0.0));
    let wire: Wire = builder::rsweep(&v0, Point3::origin(), Vector3::unit_x(), Rad(PI));
    let shell = builder::cone(&wire, Vector3::unit_y(), Rad(7.0));
    let sphere = Solid::new(vec![shell]);
    let json = serde_json::to_vec_pretty(&sphere).unwrap();
    std::fs::write("sphere.json", json).unwrap();
}