[−][src]Enum density_mesh_core::DensityMeshGenerator
Density mesh generator state object. It allows you to process mesh generation in steps and track progress or cancel generation in the middle of the process.
Examples
use density_mesh_core::*; let map = DensityMap::new(2, 2, 1, vec![1, 2, 3, 1]).unwrap(); let settings = GenerateDensityMeshSettings { points_separation: 0.5, visibility_threshold: 0.0, steepness_threshold: 0.0, ..Default::default() }; let mut generator = DensityMeshGenerator::new(vec![], map, settings); loop { match generator.process().unwrap().get_mesh_or_self() { Ok(mesh) => { println!("{:#?}", mesh); return; }, Err(gen) => generator = gen, } }
Variants
Fields of FindingPoints
Fields of Triangulate
Fields of Completed
mesh: DensityMesh
progress_limit: usize
Implementations
impl DensityMeshGenerator
[src]
pub fn new(
points: Vec<Coord>,
map: DensityMap,
settings: GenerateDensityMeshSettings
) -> Self
[src]
points: Vec<Coord>,
map: DensityMap,
settings: GenerateDensityMeshSettings
) -> Self
Creates new generator instance. Check struct documentation for examples.
Arguments
points
- List of initial points.map
- Density map.settings
- Density mesh generation settings.
Returns
New generator instance.
pub fn progress(&self) -> (usize, usize, Scalar)
[src]
pub fn is_done(&self) -> bool
[src]
pub fn get_mesh_or_self(self) -> Result<DensityMesh, Self>
[src]
Tries to get inner generated mesh when ready, otherwise gets itself. This function consumes generator!
Returns
Result with mesh (Ok) when completed, or self (Err) when still processing.
Examples
use density_mesh_core::*; let map = DensityMap::new(2, 2, 1, vec![1, 2, 3, 1]).unwrap(); let settings = GenerateDensityMeshSettings { points_separation: 0.5, visibility_threshold: 0.0, steepness_threshold: 0.0, ..Default::default() }; let mut generator = DensityMeshGenerator::new(vec![], map, settings); match generator.get_mesh_or_self() { Ok(mesh) => println!("{:#?}", mesh), Err(gen) => generator = gen, }
pub fn process(self) -> Result<Self, GenerateDensityMeshError>
[src]
Process mesh generation. Check struct documentation for examples. This function consumes generator!
Returns
Result with self when processing step was successful, or error.
Trait Implementations
impl Clone for DensityMeshGenerator
[src]
fn clone(&self) -> DensityMeshGenerator
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for DensityMeshGenerator
[src]
impl Default for DensityMeshGenerator
[src]
impl<'de> Deserialize<'de> for DensityMeshGenerator
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl PartialEq<DensityMeshGenerator> for DensityMeshGenerator
[src]
fn eq(&self, other: &DensityMeshGenerator) -> bool
[src]
fn ne(&self, other: &DensityMeshGenerator) -> bool
[src]
impl Serialize for DensityMeshGenerator
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl StructuralPartialEq for DensityMeshGenerator
[src]
Auto Trait Implementations
impl RefUnwindSafe for DensityMeshGenerator
impl Send for DensityMeshGenerator
impl Sync for DensityMeshGenerator
impl Unpin for DensityMeshGenerator
impl UnwindSafe for DensityMeshGenerator
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,