#[repr(C)]
pub struct Square<T> {
pub x: T,
pub y: T,
pub s: T,
}
Expand description
A square is a special case of a rectangle_2d, where the width and height are equal.
The constructor will not check the legality of the parameters, call [is_valid
] to ensure that the rectangle_2d is legal.
let rect = Square::new(0.0, 0.0, 1.0);
The origin x points of the square.
The origin y points of the square.
The side length of the square.
Create a square_2d from 3 properties
The constructor will not check the legality of the parameters, call [is_valid
] to ensure that the rectangle_2d is legal.
let rect = Square::new(0.0, 0.0, 1.0);
Create a square_2d from origin and side
The constructor will not check the legality of the parameters, call [is_valid
] to ensure that the rectangle_2d is legal.
let rect = Square::from_anchor((0.0, 0.0), 1.0);
Create a rectangle_2d from center and side
The constructor will not check the legality of the parameters, call [is_valid
] to ensure that the rectangle_2d is legal.
let rect = Square::from_center((0.0, 0.0), 1.0);
Get the origin of the square.
Performs copy-assignment from
source
.
Read more
Formats the value using the given formatter.
Read more
Deserialize this value from the given Serde deserializer.
Read more
Formats the value using the given formatter.
Read more
This method tests for self
and other
values to be equal, and is used
by ==
.
This method tests for !=
. The default implementation is almost always
sufficient, and should not be overridden without very good reason.
Serialize this value into the given Serde serializer.
Read more
The value type of the shape.
Returns true if the shape is valid and in normal form.
Returns true if the shape successfully normalized.
Returns the boundary of the shape.
Returns the owned vertices of the shape.
Read more
Returns the owned edges of the shape.
Immutably borrows from an owned value.
Read more
Mutably borrows from an owned value.
Read more
Returns the argument unchanged.
Calls U::from(self)
.
That is, this conversion is whatever the implementation of
From<T> for U
chooses to do.
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning.
Read more
Uses borrowed data to replace owned data, usually by cloning.
Read more
Converts the given value to a
String
.
Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.