pub struct Image<N: Copy + RealField> { /* private fields */ }
Implementations§
source§impl<N: Copy + RealField> Image<N>
impl<N: Copy + RealField> Image<N>
sourcepub fn new(frame: &Frame<N>, scope: &Scope<N>, max: Point2<N>) -> Self
pub fn new(frame: &Frame<N>, scope: &Scope<N>, max: Point2<N>) -> Self
Computes initial transformations from frame, scope, and screen’s width and height.
sourcepub fn compute(&mut self, frame: Frame<N>, scope: Scope<N>) -> Option<bool>
pub fn compute(&mut self, frame: Frame<N>, scope: Scope<N>) -> Option<bool>
Recomputes only cached matrices whose parameters have changed, see Self::set_compute()
.
Returns Some(true)
on success, Some(false)
on failure, and None
with no changes.
sourcepub fn set_compute(&mut self, compute_mat: bool, compute_inv: bool)
pub fn set_compute(&mut self, compute_mat: bool, compute_inv: bool)
Sets whether to compute transformation and inverse transformation with Self::compute()
.
Default is (true, true)
.
sourcepub const fn pos(&self) -> &Point2<N>
pub const fn pos(&self) -> &Point2<N>
Current position in screen space of hovering input or pointing device.
sourcepub fn set_pos(&mut self, pos: Point2<N>)
pub fn set_pos(&mut self, pos: Point2<N>)
Sets current position in screen space of hovering input or pointing device.
sourcepub const fn max(&self) -> &Point2<N>
pub const fn max(&self) -> &Point2<N>
Maximum position in screen space as screen’s width and height.
sourcepub fn set_max(&mut self, max: Point2<N>)
pub fn set_max(&mut self, max: Point2<N>)
Sets maximum position in screen space as screen’s width and height.
sourcepub const fn upp(&self) -> N
pub const fn upp(&self) -> N
Cached unit per pixel on focus plane to scale/project positions/vectors onto focus plane.
sourcepub const fn view_isometry(&self) -> &Isometry3<N>
pub const fn view_isometry(&self) -> &Isometry3<N>
Cached view isometry.
sourcepub fn compute_view(&mut self, frame: &Frame<N>)
pub fn compute_view(&mut self, frame: &Frame<N>)
Computes view isometry and matrix from frame wrt camera eye and target.
sourcepub const fn projection(&self) -> &Matrix4<N>
pub const fn projection(&self) -> &Matrix4<N>
Cached projection matrix.
sourcepub fn compute_projection_and_upp(&mut self, zat: N, scope: &Scope<N>)
pub fn compute_projection_and_upp(&mut self, zat: N, scope: &Scope<N>)
Computes projection matrix and unit per pixel on focus plane.
sourcepub const fn transformation(&self) -> &Matrix4<N>
pub const fn transformation(&self) -> &Matrix4<N>
Cached projection view matrix.
sourcepub fn compute_transformation(&mut self)
pub fn compute_transformation(&mut self)
Computes projection view matrix.
sourcepub const fn inverse_transformation(&self) -> &Matrix4<N>
pub const fn inverse_transformation(&self) -> &Matrix4<N>
Cached inverse projection view matrix.
sourcepub fn compute_inverse_transformation(&mut self) -> bool
pub fn compute_inverse_transformation(&mut self) -> bool
Computes inverse of projection view matrix.
Returns true
on success.
sourcepub fn clamp_pos_wrt_max(pos: &Point2<N>, max: &Point2<N>) -> Point2<N>
pub fn clamp_pos_wrt_max(pos: &Point2<N>, max: &Point2<N>) -> Point2<N>
Clamps position in screen space wrt its maximum in screen space.
sourcepub fn transform_pos_and_max_wrt_max(
pos: &Point2<N>,
max: &Point2<N>,
) -> (Point2<N>, Point2<N>)
pub fn transform_pos_and_max_wrt_max( pos: &Point2<N>, max: &Point2<N>, ) -> (Point2<N>, Point2<N>)
Transforms position and its maximum from screen to camera space wrt its maximum.
sourcepub fn transform_pos(&self, pos: &Point2<N>) -> Point2<N>
pub fn transform_pos(&self, pos: &Point2<N>) -> Point2<N>
Transforms position from screen to camera space.
sourcepub fn transform_vec(pos: &Vector2<N>) -> Vector2<N>
pub fn transform_vec(pos: &Vector2<N>) -> Vector2<N>
Transforms vector from screen to camera space.
sourcepub fn project_pos(&self, pos: &Point2<N>) -> Point3<N>
pub fn project_pos(&self, pos: &Point2<N>) -> Point3<N>
Transforms position from screen to camera space and projects it onto focus plane.
sourcepub fn project_vec(&self, vec: &Vector2<N>) -> Vector3<N>
pub fn project_vec(&self, vec: &Vector2<N>) -> Vector3<N>
Transforms vector from screen to camera space and projects it onto focus plane.
Trait Implementations§
source§impl<N: Copy + RealField> Archive for Image<N>
Available on crate feature rkyv
only.
impl<N: Copy + RealField> Archive for Image<N>
rkyv
only.source§impl<'de, N> Deserialize<'de> for Image<N>
impl<'de, N> Deserialize<'de> for Image<N>
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>,
source§impl<De: Fallible + ?Sized, N: Copy + RealField> Deserialize<Image<N>, De> for Image<N>
Available on crate feature rkyv
only.
impl<De: Fallible + ?Sized, N: Copy + RealField> Deserialize<Image<N>, De> for Image<N>
rkyv
only.source§impl<N: PartialEq + Copy + RealField> PartialEq for Image<N>
impl<N: PartialEq + Copy + RealField> PartialEq for Image<N>
source§impl<Ser: Fallible + ?Sized, N: Copy + RealField> Serialize<Ser> for Image<N>
Available on crate feature rkyv
only.
impl<Ser: Fallible + ?Sized, N: Copy + RealField> Serialize<Ser> for Image<N>
rkyv
only.impl<N: Copy + Copy + RealField> Copy for Image<N>
impl<N: Eq + Copy + RealField> Eq for Image<N>
impl<N: Copy + RealField> StructuralPartialEq for Image<N>
Auto Trait Implementations§
impl<N> Freeze for Image<N>where
N: Freeze,
impl<N> RefUnwindSafe for Image<N>where
N: RefUnwindSafe,
impl<N> Send for Image<N>
impl<N> Sync for Image<N>
impl<N> Unpin for Image<N>where
N: Unpin,
impl<N> UnwindSafe for Image<N>where
N: UnwindSafe,
Blanket Implementations§
source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
source§impl<T> ArchiveUnsized for Twhere
T: Archive,
impl<T> ArchiveUnsized for Twhere
T: Archive,
§type Archived = <T as Archive>::Archived
type Archived = <T as Archive>::Archived
Archive
, it may be unsized. Read more§type MetadataResolver = ()
type MetadataResolver = ()
source§unsafe fn resolve_metadata(
&self,
_: usize,
_: <T as ArchiveUnsized>::MetadataResolver,
_: *mut <<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata,
)
unsafe fn resolve_metadata( &self, _: usize, _: <T as ArchiveUnsized>::MetadataResolver, _: *mut <<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata, )
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
source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
source§impl<T, S> SerializeUnsized<S> for T
impl<T, S> SerializeUnsized<S> for T
source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read moresource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.