public CameraItem(ScalarItem hsize, ScalarItem vsize, ScalarItem field_of_view) { Hsize = hsize; Vsize = vsize; FieldOfView = field_of_view; Transform = new MatrixItem(); compute_parameters(); }
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))); }
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)); }
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); }
StackItem divide(MatrixItem l, ScalarItem r) { return(new MatrixItem(Matrix4x4.Multiply(l.MatrixValue, 1.0f / r.FloatValue))); }
StackItem multiply(MatrixItem l, MatrixItem r) { return(new MatrixItem(Matrix4x4.Multiply(l.MatrixValue, r.MatrixValue))); }
StackItem negate(MatrixItem item) { return(new MatrixItem(-item.MatrixValue)); }
StackItem minus(MatrixItem l, MatrixItem r) { return(new MatrixItem(l.MatrixValue - r.MatrixValue)); }
StackItem plus(MatrixItem l, MatrixItem r) { return(new MatrixItem(l.MatrixValue + r.MatrixValue)); }
public bool IsEqual(MatrixItem rhs) { return(this.MatrixValue == rhs.MatrixValue); }