Skip to main content

Field

Trait Field 

Source
pub trait Field {
    // Required methods
    fn scale(&self) -> f64;
    fn length(&self) -> f64;
    fn top(&self) -> f64;
    fn lowest(&self, x: f64, y: f64) -> (f64, Part);
    fn height(&self, part: Part, x: f64, y: f64) -> f64;
    fn continued(&self, part: Part, x: f64, y: f64) -> f64;
    fn plane(&self, p: Part, q: Part, x: f64, y: f64) -> Option<f64>;
    fn witnesses(&self, cell: f64) -> Vec<[f64; 2]>;

    // Provided methods
    fn seeds(&self) -> Vec<[f64; 2]> { ... }
    fn below(&self, p: Part, q: Part, x: f64, y: f64) -> bool { ... }
    fn equation(&self, p: Part, q: Part, x: f64, y: f64) -> f64 { ... }
    fn meets(&self, p: Part, q: Part, x: f64, y: f64, tolerance: f64) -> bool { ... }
}
Expand description

What a plan reads: over each point (x, y) of its chart, the part lowest there and its height (the stock’s top where nothing cuts below it), and each part’s own height and surface (continued past where it is read). A mill’s envelope over level ground reads in plan (x, y) and height z; a dome’s reads directions in a chart of the sphere, and the distance along each ray.

Required Methods§

Source

fn scale(&self) -> f64

The length the tolerances are shares of (the ball’s radius).

Source

fn length(&self) -> f64

The length one unit of the chart spans, about (1 in plan).

Source

fn top(&self) -> f64

The stock’s top: the height read where nothing cuts below it.

Source

fn lowest(&self, x: f64, y: f64) -> (f64, Part)

The lowest part over (x, y) and its height; ties to the lesser part.

Source

fn height(&self, part: Part, x: f64, y: f64) -> f64

The part’s height over (x, y), +∞ where it is not read.

Source

fn continued(&self, part: Part, x: f64, y: f64) -> f64

The part’s surface continued past where it is read (NaN past its reach), for the boundary equations.

Source

fn plane(&self, p: Part, q: Part, x: f64, y: f64) -> Option<f64>

For two parts that meet where one of them stops being read (a tube and its own ball, two stretches of one surface), the signed distance of the point from the surface they meet on; None for parts that meet where their heights agree.

Source

fn witnesses(&self, cell: f64) -> Vec<[f64; 2]>

Points (in the chart) each part that is lowest anywhere is lowest at or near, read at a grid of cell: a part lowest at one that the plan does not name is narrower than the cell.

Provided Methods§

Source

fn seeds(&self) -> Vec<[f64; 2]>

Points (in the chart) where a boundary turns a corner that no third part marks (two parts meeting at a point of both their centre curves): each is made a vertex of the plan, its cell read down to it.

Source

fn below(&self, p: Part, q: Part, x: f64, y: f64) -> bool

Whether p is read below q at (x, y) (the pair’s own comparison, ties to the lesser part).

Source

fn equation(&self, p: Part, q: Part, x: f64, y: f64) -> f64

The equation of the boundary between p and q at (x, y): zero on it.

Source

fn meets(&self, p: Part, q: Part, x: f64, y: f64, tolerance: f64) -> bool

Whether (x, y) lies on the curve where p and q meet, to tolerance: their surfaces at one height there, and on the surface they meet on where they have one.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§