예제 #1
0
 public Vector4f(Vector3f v, float w)
 {
     X = v.X;
     Y = v.Y;
     Z = v.Z;
     W = w;
 }
예제 #2
0
 public static Vector3f Cross(Vector3f v1, Vector3f v2)
 {
     throw new NotImplementedException();
     /*return new Vector3f(
         v1.Y * v2.Z - v2.Y * v1.Z,
         v1.Z * v2.X - v2.X * v1.Z,
         v1.X * v2.Z - v2.Y * v1.X
         );*/
 }
예제 #3
0
 public static Vector3f ComponentMultiply(Vector3f v1, Vector3f v2)
 {
     return new Vector3f(v1.X * v2.X, v1.Y * v2.Y, v1.Z * v2.Z);
 }
예제 #4
0
 public static Vector3f ComponentDivide(Vector3f v1, Vector3f v2)
 {
     return new Vector3f(v1.X / v2.X, v1.Y / v2.Y, v1.Z / v2.Z);
 }
예제 #5
0
 public Vector3f TransformRelative(Vector3f v)
 {
     return (this * new Vector4f(v, 0)).XYZ;
 }
예제 #6
0
 public static Quaternion CreateFromAxisAngle(Vector3f axis, float angle)
 {
     return CreateFromUnitAxisAngle(axis.Normalized, angle);
 }
예제 #7
0
 public static float Dot(Vector3f vL, Vector3f vR)
 {
     return Vector3f.Dot(vL, vR);
 }
예제 #8
0
 public static float Dot(Vector3f v1, Vector3f v2)
 {
     return v1.X * v2.X + v1.Y * v2.Y + v1.Z * v2.Z;
 }
예제 #9
0
 public static Matrix4f CreateRotation(float angle, Vector3f axis)
 {
     Vector3f u = axis.Normalized;
     float c = (float)Math.Cos(angle);
     float s = (float)Math.Sin(angle);
     Matrix4f result = Matrix4f.Identity;
     result[0, 0] = u.X * u.X + (1 - u.X * u.X) * c;
     result[0, 1] = u.X * u.Y * (1 - c) - u.Z * s;
     result[0, 2] = u.X * u.Z * (1 - c) + u.Y * s;
     result[1, 0] = u.X * u.Y * (1 - c) + u.Z * s;
     result[1, 1] = u.Y * u.Y + (1 - u.Y * u.Y) * c;
     result[1, 2] = u.Y * u.Z * (1 - c) - u.X * s;
     result[2, 0] = u.X * u.Z * (1 - c) - u.Y * s;
     result[2, 1] = u.Y * u.Z * (1 - c) + u.X * s;
     result[2, 2] = u.Z * u.Z + (1 - u.Z * u.Z) * c;
     return result;
 }
예제 #10
0
 public Quaternion(float w)
 {
     this.w = w;
     this.v = Vector3f.Zero;
 }
예제 #11
0
 public Quaternion(float w, float x, float y, float z)
 {
     this.w = w;
     this.v = new Vector3f(x, y, z);
 }
예제 #12
0
 public Quaternion(float w, Vector3f v)
 {
     this.w = w;
     this.v = v;
 }
예제 #13
0
 //Requires a normalized quaternion
 public Vector3f RotateVector(Vector3f vec)
 {
     Debug.Assert(IsNormalized);
     throw new NotImplementedException();
 }
예제 #14
0
 public static Quaternion CreateFromUnitAxisAngle(Vector3f axisUnitVector, float angle)
 {
     //Debug.Assert(axisUnitVector.IsUnit);
     float angle2 = 0.5f * angle;
     return new Quaternion((float)Math.Cos(angle2), axisUnitVector * (float)Math.Sin(angle2));
 }
예제 #15
0
 public static float Distance(Vector3f v1, Vector3f v2)
 {
     return (v1 - v2).Length;
 }
예제 #16
0
 public static float DistanceSquared(Vector3f v1, Vector3f v2)
 {
     return (v1 - v2).LengthSquared;
 }
예제 #17
0
 public static Matrix4f CreateTranslation(Vector3f v)
 {
     return new Matrix4f(Vector4f.UnitX, Vector4f.UnitY, Vector4f.UnitZ, new Vector4f(v, 0));
 }
예제 #18
0
 /*public float Dot(Vector4f vL, Vector4f vR)
 {
     return Vector4f.Dot(vL, vR);
 }*/
 public static Vector3f Cross(Vector3f vL, Vector3f vR)
 {
     return Vector3f.Cross(vL, vR);
 }
예제 #19
0
 /// <summary>
 /// Requires Col(3)==UnitW
 /// </summary>
 public Matrix4f AppendTranslation(Vector3f v)
 {
     Matrix4f result = this;
     result.row3 += new Vector4f(v, 0);
     return result;
 }
예제 #20
0
파일: Ray.cs 프로젝트: jorik041/ChaosUtil
 public RayF(Vector3f start, Vector3f direction)
     : this()
 {
     Direction = direction.Normalized;
     Start = start;
 }
예제 #21
0
 public Vector3f TransformAbsolute(Vector3f v)
 {
     return (this * new Vector4f(v, 1)).XYZ;
 }