Struct Trajectory
pub struct Trajectory(/* private fields */);Expand description
Trajectory defines a series of points following a geometrical path. For example, use a trajectory as align paths for 3d objects or animation paths. You can create trajectory as a spline, circle or line trajectory.
§Examples
Create a circle trajectory and evaluate values from it.
Implementations§
§impl Trajectory
impl Trajectory
pub fn create_circle(
domain: &Domain,
name: impl AsRef<KanziStr>,
origin: Vector3,
up: Vector3,
angle_in_degrees: f32,
radius: f32,
) -> Result<Trajectory, Error>
pub fn create_circle( domain: &Domain, name: impl AsRef<KanziStr>, origin: Vector3, up: Vector3, angle_in_degrees: f32, radius: f32, ) -> Result<Trajectory, Error>
Creates a circle trajectory.
§Arguments
domain- Domain.name- Name of trajectory.origin- Origin of the circle trajectory.up- Normal vector for the plane where the circle exists. Kanzi internally normalizes the vector.angle_in_degrees- Rotation angle of the circle trajectory in its plane, in degrees.radius- Radius of the circle.
pub fn get_radius(&self) -> Result<f32, Error>
pub fn get_radius(&self) -> Result<f32, Error>
Gets the radius of a circle trajectory. Use this method to find out how big the radius of a circle trajectory is.
§Errors
Returns an INVALID_ARGUMENT error if trajectory doesn’t have Circle type.
pub fn get_angle(&self) -> Result<f32, Error>
pub fn get_angle(&self) -> Result<f32, Error>
Gets the angle of a circle trajectory in degrees. Use this method to find out how a circle trajectory is rotated.
§Errors
Returns an INVALID_ARGUMENT error if trajectory doesn’t have Circle type.
pub fn get_circle_normal(&self) -> Result<Vector3, Error>
pub fn get_circle_normal(&self) -> Result<Vector3, Error>
Gets the normal vector for the plane of the circle trajectory. Use this method to see which direction the circle trajectory is facing.
§Errors
Returns an INVALID_ARGUMENT error if trajectory doesn’t have Circle type.
pub fn get_circle_origin(&self) -> Result<Vector3, Error>
pub fn get_circle_origin(&self) -> Result<Vector3, Error>
Gets the origin point of the circle trajectory. Use this method to see where the circle trajectory is located.
§Errors
Returns an INVALID_ARGUMENT error if trajectory doesn’t have Circle type.
§impl Trajectory
impl Trajectory
pub fn create_line(
domain: &Domain,
name: impl AsRef<KanziStr>,
origin: Vector3,
direction: Vector3,
length: f32,
) -> Result<Trajectory, Error>
pub fn create_line( domain: &Domain, name: impl AsRef<KanziStr>, origin: Vector3, direction: Vector3, length: f32, ) -> Result<Trajectory, Error>
Creates a line trajectory.
§Arguments
domain- The domain where to create the trajectory object.name- The name of the trajectory object.origin- Origin of the line trajectory.direction- Direction vector for the line. Kanzi internally normalizes the direction.length- Length of the line.
pub fn get_line_direction(&self) -> Result<Vector3, Error>
pub fn get_line_direction(&self) -> Result<Vector3, Error>
Gets the direction vector of the line trajectory. Use this method to see which direction a line trajectory is pointing towards.
§Errors
Returns an INVALID_ARGUMENT error if trajectory doesn’t have Line type.
§impl Trajectory
impl Trajectory
pub fn create_spline(
domain: &Domain,
name: impl AsRef<KanziStr>,
spline: &Spline,
) -> Result<Trajectory, Error>
pub fn create_spline( domain: &Domain, name: impl AsRef<KanziStr>, spline: &Spline, ) -> Result<Trajectory, Error>
Creates a spline trajectory.
§Arguments
domain- Domain.name- Name of the trajectory.spline- Spline to use as a trajectory.
pub fn copy_spline(&self) -> Result<Spline, Error>
pub fn copy_spline(&self) -> Result<Spline, Error>
Gets a cloned copy of the spline in this trajectory. Use this to get a new identical copy of the spline in spline trajectory.
§impl Trajectory
impl Trajectory
pub fn get_type(&self) -> Result<Type, Error>
pub fn get_type(&self) -> Result<Type, Error>
Gets the type of the trajectory. Use this method to find out whether the trajectory is a spline, line, or a circle trajectory.
pub fn get_point_absolute(
&self,
length_parameter: f32,
) -> Result<Vector3, Error>
pub fn get_point_absolute( &self, length_parameter: f32, ) -> Result<Vector3, Error>
Gets a point on a trajectory by using absolute coordinates ranging from 0.0f to the length of the trajectory. If the trajectory has a looping spline, Kanzi wraps around the trajectory the coordinates lower than 0.0f and higher than the length of the trajectory.
§Arguments
length_parameter- Point on the trajectory.
pub fn get_point_relative(&self, phase_parameter: f32) -> Result<Vector3, Error>
pub fn get_point_relative(&self, phase_parameter: f32) -> Result<Vector3, Error>
Gets a point on the trajectory by using relative coordinates.
If the trajectory has a looping spline, Kanzi wraps around the trajectory
the coordinates lower than 0.0 and higher than 1.0.
§Arguments
phase_parameter- Point on the trajectory.0.0start,1.0end.
pub fn is_complete(&self) -> Result<bool, Error>
pub fn is_complete(&self) -> Result<bool, Error>
Returns true if trajectory is complete and usable.
pub fn get_length(&self) -> Result<f32, Error>
pub fn get_length(&self) -> Result<f32, Error>
Gets the curve length of trajectory.
pub fn get_visualization_point_count(&self) -> Result<u32, Error>
pub fn get_visualization_point_count(&self) -> Result<u32, Error>
Gets the number of points recommended for visualizing the trajectory.
pub fn get_visualization_point(
&self,
point_index: u32,
point_count: u32,
) -> Result<Vector3, Error>
pub fn get_visualization_point( &self, point_index: u32, point_count: u32, ) -> Result<Vector3, Error>
Gets a visualization point of the trajectory.
pub fn scale_point(
&self,
point: Vector3,
transform: &Matrix4x4,
scaling: Vector3,
) -> Result<Vector3, Error>
pub fn scale_point( &self, point: Vector3, transform: &Matrix4x4, scaling: Vector3, ) -> Result<Vector3, Error>
Gets point that is scaled along the line trajectory, otherwise returns the point multiplied by the given transformation matrix and scaling factor. Use this to place a point along the line trajectory, at given scaling factor.
§Arguments
point- point to be scaled.transform- transformation matrix applied to the point.scaling- scaling the point.
Methods from Deref<Target = Resource>§
pub fn get_name(&self) -> Result<KanziString, Error>
pub fn get_name(&self) -> Result<KanziString, Error>
Gets the resource name.
pub fn get_url(&self) -> Result<KanziString, Error>
pub fn get_url(&self) -> Result<KanziString, Error>
Gets the resource URL. Note that the URL is not necessarily in URL form if resource has been just created.
§Returns
URL string.
Methods from Deref<Target = Object>§
pub fn as_ptr(&self) -> *mut ObjectWrapper
pub fn as_wrapper(&self) -> &ObjectWrapper
pub fn as_object(&self) -> &Object
pub fn as_object(&self) -> &Object
Represents any type inheriting from Object as &Object.
This is useful for comparisions when PartialEq traits failed to compare objects of
different types.
let child = screen.get_child(0)?;
let parent = child.get_parent()?.into_error(ErrorKind::ObjectNotFound)?;
// assert_eq!(screen, parent); // <- Fails to compile!
assert_eq!(screen.as_object(), parent.as_object());pub fn get_native(&self) -> Result<NonNull<c_void>, Error>
pub fn get_native(&self) -> Result<NonNull<c_void>, Error>
Gets a pointer to the backing C++ instance.
pub fn get_property<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<<T as VariantConstraint>::RetArg, Error>where
T: PropertyTypeConstraint,
pub fn get_property<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<<T as VariantConstraint>::RetArg, Error>where
T: PropertyTypeConstraint,
Returns the current value of a property disregarding modifiers.
Base value is affected by the following inputs where the highest entry in the list determines the base value:
- Local value set with setProperty or loaded from kzb
- Value set by a style affecting the property.
- Value defined by class metadata.
Modifiers are not applied, the highest-priority base value is returned.
If no inputs to the property value can be established the system returns the value default value from property type metadata.
§Arguments
property_type- The property type identifying the property to retrieve.
§Returns
The evaluated property value.
pub fn get_optional_property<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<Option<<T as VariantConstraint>::RetArg>, Error>where
T: PropertyTypeConstraint,
pub fn get_optional_property<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<Option<<T as VariantConstraint>::RetArg>, Error>where
T: PropertyTypeConstraint,
Returns the current value of a property disregarding modifiers, but does not default to the value in property metadata if there are no inputs to the property value.
If there is no value sources, None is returned.
If no inputs to the property value can be established the system returns the value default value from property type metadata.
§Arguments
property_type- The property type identifying the property to retrieve.
§Returns
The evaluated property value.
pub fn set_property<T>(
&self,
property_type: &PropertyType<T>,
value: <T as VariantConstraint>::DataArg<'_>,
) -> Result<(), Error>where
T: PropertyTypeConstraint,
pub fn set_property<T>(
&self,
property_type: &PropertyType<T>,
value: <T as VariantConstraint>::DataArg<'_>,
) -> Result<(), Error>where
T: PropertyTypeConstraint,
Sets the local value of a property type.
pub fn has_value<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<bool, Error>where
T: PropertyTypeConstraint,
pub fn has_value<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<bool, Error>where
T: PropertyTypeConstraint,
Evaluates whether there are any inputs into the property value. Both value sources and modifiers are taken into account.
§Returns
Returns true if there are inputs into the property value, false otherwise.
pub fn remove_local_value<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<(), Error>where
T: PropertyTypeConstraint,
pub fn remove_local_value<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<(), Error>where
T: PropertyTypeConstraint,
Removes the local value associated with the property.
pub fn get_metaclass(&self) -> Result<Metaclass, Error>
pub fn get_metaclass(&self) -> Result<Metaclass, Error>
Returns the metaclass of the dynamic type of the object.
pub fn get_domain(&self) -> Result<Domain, Error>
pub fn get_domain(&self) -> Result<Domain, Error>
Returns the domain the object belongs to.
pub fn set_flag_keep_during_patching<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<(), Error>where
T: PropertyTypeConstraint,
pub fn set_flag_keep_during_patching<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<(), Error>where
T: PropertyTypeConstraint,
Sets the flag to indicate that the property was loaded from KZB.
pub fn debug_string(&self) -> Result<String, Error>
pub fn debug_string(&self) -> Result<String, Error>
Builds a string representation of the object intended for debugging purposes.
Trait Implementations§
§impl Clone for Trajectory
impl Clone for Trajectory
§fn clone(&self) -> Trajectory
fn clone(&self) -> Trajectory
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more