Exemple #1
0
 public CameraItem(ScalarItem hsize, ScalarItem vsize, ScalarItem field_of_view)
 {
     Hsize       = hsize;
     Vsize       = vsize;
     FieldOfView = field_of_view;
     Transform   = new MatrixItem();
     compute_parameters();
 }
Exemple #2
0
 StackItem multiply(MatrixItem l, Vector4Item r)
 {
     return(new Vector4Item(
                Vector4.Dot(l.GetRow(0), r.Vector4Value),
                Vector4.Dot(l.GetRow(1), r.Vector4Value),
                Vector4.Dot(l.GetRow(2), r.Vector4Value),
                Vector4.Dot(l.GetRow(3), r.Vector4Value)));
 }
Exemple #3
0
        StackItem multiply(MatrixItem l, RayItem r)
        {
            Vector4Item origin    = new Vector4Item(r.Origin);
            Vector4Item direction = new Vector4Item(r.Direction);

            Vector4Item newOrigin    = (Vector4Item)multiply(l, origin);
            Vector4Item newDirection = (Vector4Item)multiply(l, direction);

            return(new RayItem(newOrigin.Vector4Value, newDirection.Vector4Value));
        }
Exemple #4
0
 public bool ApproxEqual(MatrixItem rhs, double tolerance)
 {
     for (int i = 0; i < 4; i++)
     {
         for (int j = 0; j < 4; j++)
         {
             if (Math.Abs(this.GetElement(i, j) - rhs.GetElement(i, j)) > tolerance)
             {
                 return(false);
             }
         }
     }
     return(true);
 }
Exemple #5
0
 StackItem divide(MatrixItem l, ScalarItem r)
 {
     return(new MatrixItem(Matrix4x4.Multiply(l.MatrixValue, 1.0f / r.FloatValue)));
 }
Exemple #6
0
 StackItem multiply(MatrixItem l, MatrixItem r)
 {
     return(new MatrixItem(Matrix4x4.Multiply(l.MatrixValue, r.MatrixValue)));
 }
Exemple #7
0
 StackItem negate(MatrixItem item)
 {
     return(new MatrixItem(-item.MatrixValue));
 }
Exemple #8
0
 StackItem minus(MatrixItem l, MatrixItem r)
 {
     return(new MatrixItem(l.MatrixValue - r.MatrixValue));
 }
Exemple #9
0
 StackItem plus(MatrixItem l, MatrixItem r)
 {
     return(new MatrixItem(l.MatrixValue + r.MatrixValue));
 }
Exemple #10
0
 public bool IsEqual(MatrixItem rhs)
 {
     return(this.MatrixValue == rhs.MatrixValue);
 }