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<'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>,
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> 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: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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.