@@ -101,14 +101,29 @@ impl<S> Matrix2<S> {
101
101
impl < S : BaseFloat > Matrix2 < S > {
102
102
/// Create a transformation matrix that will cause `unit_x()` to point at
103
103
/// `dir`. `unit_y()` will be perpendicular to `dir`, and the closest to `up`.
104
+ #[ deprecated = "Use Matrix2::look_to" ]
104
105
pub fn look_at ( dir : Vector2 < S > , up : Vector2 < S > ) -> Matrix2 < S > {
105
- Matrix2 :: look_at_stable ( dir, up. x * dir . y >= up . y * dir . x )
106
+ Matrix2 :: look_to ( dir, up)
106
107
}
107
108
108
109
/// Crate a transformation that will cause `unit_x()` to point at
109
- /// `dir`. This is similar to `look_at `, but does not take an `up` vector.
110
+ /// `dir`. This is similar to `look_to `, but does not take an `up` vector.
110
111
/// This will not cause `unit_y()` to flip when `dir` crosses over the `up` vector.
112
+ #[ deprecated = "Use Matrix2::look_to_stable" ]
111
113
pub fn look_at_stable ( dir : Vector2 < S > , flip : bool ) -> Matrix2 < S > {
114
+ Matrix2 :: look_to_stable ( dir, flip)
115
+ }
116
+
117
+ /// Create a transformation matrix that will cause `unit_x()` to point at
118
+ /// `dir`. `unit_y()` will be perpendicular to `dir`, and the closest to `up`.
119
+ pub fn look_to ( dir : Vector2 < S > , up : Vector2 < S > ) -> Matrix2 < S > {
120
+ Matrix2 :: look_to_stable ( dir, up. x * dir. y >= up. y * dir. x )
121
+ }
122
+
123
+ /// Crate a transformation that will cause `unit_x()` to point at
124
+ /// `dir`. This is similar to `look_to`, but does not take an `up` vector.
125
+ /// This will not cause `unit_y()` to flip when `dir` crosses over the `up` vector.
126
+ pub fn look_to_stable ( dir : Vector2 < S > , flip : bool ) -> Matrix2 < S > {
112
127
let basis1 = dir. normalize ( ) ;
113
128
let basis2 = if flip {
114
129
Vector2 :: new ( basis1. y , -basis1. x )
@@ -1093,17 +1108,17 @@ impl<S: BaseFloat> Transform<Point2<S>> for Matrix3<S> {
1093
1108
1094
1109
fn look_at ( eye : Point2 < S > , center : Point2 < S > , up : Vector2 < S > ) -> Matrix3 < S > {
1095
1110
let dir = center - eye;
1096
- Matrix3 :: from ( Matrix2 :: look_at ( dir, up) )
1111
+ Matrix3 :: from ( Matrix2 :: look_to ( dir, up) )
1097
1112
}
1098
1113
1099
1114
fn look_at_lh ( eye : Point2 < S > , center : Point2 < S > , up : Vector2 < S > ) -> Matrix3 < S > {
1100
1115
let dir = center - eye;
1101
- Matrix3 :: from ( Matrix2 :: look_at ( dir, up) )
1116
+ Matrix3 :: from ( Matrix2 :: look_to ( dir, up) )
1102
1117
}
1103
1118
1104
1119
fn look_at_rh ( eye : Point2 < S > , center : Point2 < S > , up : Vector2 < S > ) -> Matrix3 < S > {
1105
1120
let dir = eye - center;
1106
- Matrix3 :: from ( Matrix2 :: look_at ( dir, up) )
1121
+ Matrix3 :: from ( Matrix2 :: look_to ( dir, up) )
1107
1122
}
1108
1123
1109
1124
fn transform_vector ( & self , vec : Vector2 < S > ) -> Vector2 < S > {
0 commit comments