pub struct Point {
pub guid: String,
pub name: String,
_x: f32,
_y: f32,
_z: f32,
pub width: f32,
pub pointcolor: Color,
pub xform: Xform,
}
Expand description
A 3D point with visual properties and JSON serialization support.
Fields§
§guid: String
§name: String
§_x: f32
§_y: f32
§_z: f32
§width: f32
§pointcolor: Color
§xform: Xform
Implementations§
Source§impl Point
impl Point
pub fn y(&self) -> f32
pub fn z(&self) -> f32
pub fn set_y(&mut self, v: f32)
pub fn set_z(&mut self, v: f32)
Sourcepub fn jsondump(&self) -> Result<String, Box<dyn Error>>
pub fn jsondump(&self) -> Result<String, Box<dyn Error>>
Serializes the Point to a JSON string.
Sourcepub fn jsonload(json_data: &str) -> Result<Self, Box<dyn Error>>
pub fn jsonload(json_data: &str) -> Result<Self, Box<dyn Error>>
Deserializes a Point from a JSON string.
Sourcepub fn to_json(&self, filepath: &str) -> Result<(), Box<dyn Error>>
pub fn to_json(&self, filepath: &str) -> Result<(), Box<dyn Error>>
Serializes the Point to a JSON file.
Sourcepub fn from_json(filepath: &str) -> Result<Self, Box<dyn Error>>
pub fn from_json(filepath: &str) -> Result<Self, Box<dyn Error>>
Deserializes a Point from a JSON file.
Sourcepub fn ccw(a: &Point, b: &Point, c: &Point) -> bool
pub fn ccw(a: &Point, b: &Point, c: &Point) -> bool
Check if the points are in counter-clockwise order.
Sourcepub fn mid_point(&self, p: &Point) -> Point
pub fn mid_point(&self, p: &Point) -> Point
Calculate the mid point between this point and another point.
Sourcepub fn distance(&self, p: &Point) -> f32
pub fn distance(&self, p: &Point) -> f32
Calculate the distance between this point and another point.
Sourcepub fn distance_with_min(&self, p: &Point, double_min: f32) -> f32
pub fn distance_with_min(&self, p: &Point, double_min: f32) -> f32
Calculate the distance between this point and another point with custom minimum.
Trait Implementations§
Source§impl AddAssign<Vector> for Point
impl AddAssign<Vector> for Point
Source§fn add_assign(&mut self, rhs: Vector)
fn add_assign(&mut self, rhs: Vector)
Performs the
+=
operation. Read moreSource§impl<'de> Deserialize<'de> for Point
impl<'de> Deserialize<'de> for Point
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl DivAssign<f32> for Point
impl DivAssign<f32> for Point
Source§fn div_assign(&mut self, rhs: f32)
fn div_assign(&mut self, rhs: f32)
Performs the
/=
operation. Read moreSource§impl MulAssign<f32> for Point
impl MulAssign<f32> for Point
Source§fn mul_assign(&mut self, rhs: f32)
fn mul_assign(&mut self, rhs: f32)
Performs the
*=
operation. Read moreAuto Trait Implementations§
impl Freeze for Point
impl RefUnwindSafe for Point
impl Send for Point
impl Sync for Point
impl Unpin for Point
impl UnwindSafe for Point
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