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
16
//! Modeling cone.
//!
//! Generated json file can be visualized by `simple-shape-viewer`, an example of `truck-rendimpl`.

use truck_modeling::*;

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