コード例 #1
0
 public Vector4D(Vector3D v)
 {
     this.x = v.X;
     this.y = v.Y;
     this.z = v.Z;
     this.t = 1f;
 }
コード例 #2
0
 public Camera(float alpha, float beta, float zoom, Vector3D position)
 {
     this.alpha = alpha;
     this.beta = beta;
     this.position = position;
     this.forward = ComputeForward();
 }
コード例 #3
0
        public Ray ShootRay(Viewport viewport, int x, int y)
        {
            Vector3D origin = new Vector3D(
                viewport.Scaling * ((float)x + 0.5f - (float)viewport.Width / 2f),
                viewport.Scaling * ((float)y + 0.5f - (float)viewport.Height / 2f),
                0f);
            Vector4D P = new Vector4D(origin);

            Matrix RX = Matrix.CreateRotationMatrix(Axis.X, alpha);
            Matrix RY = Matrix.CreateRotationMatrix(Axis.Y, beta);
            Matrix R = RX * RY;

            Matrix T = Matrix.CreateTranslationMatrix(position);

            Vector4D realOrigin = (T * R) * P;
            return new Ray(realOrigin.Vect3D, forward);
        }
コード例 #4
0
 public static Matrix CreateTranslationMatrix(Vector3D translation)
 {
     return new Matrix(new float[4, 4]
         {
             { 1, 0, 0, translation.X},
             { 0, 1, 0, translation.Y},
             { 0, 0, 1, translation.Z},
             { 0, 0, 0, 1}
         });
 }
コード例 #5
0
 public virtual Vector3D GetNormalAtPoint(Vector3D point)
 {
     throw new NotImplementedException();
 }
コード例 #6
0
 public override Vector3D GetNormalAtPoint(Vector3D point)
 {
     return Vector3D.Zero;
 }
コード例 #7
0
 public Ray(Vector3D origin, Vector3D direction)
 {
     this.origin = origin;
     this.direction = direction;
     this.emissionObject = SceneObject.Air;
 }
コード例 #8
0
 public override Vector3D GetNormalAtPoint(Vector3D point)
 {
     return (point - center).Unit;
 }
コード例 #9
0
 public System.Drawing.Color ToRGB()
 {
     var c = 255f * color;
     var d = new Vector3D(c.X > 255f ? 255 : c.X, c.Y > 255f ? 255 : c.Y, c.Z > 255f ? 255 : c.Z);
     return System.Drawing.Color.FromArgb((int)d.X, (int)d.Y, (int)d.Z);
 }
コード例 #10
0
 public Light(Vector3D position)
 {
     this.position = position;
 }
コード例 #11
0
 public Color(float r, float g, float b)
 {
     this.color = new Vector3D(r, g, b);
 }
コード例 #12
0
 public Color(Vector3D color)
 {
     this.color = color;
 }
コード例 #13
0
        Vector3D p; //a point of the plane

        #endregion Fields

        #region Constructors

        public Plane(Vector3D p, Vector3D n)
        {
            this.p = p;
            this.n = n.Unit;
        }
コード例 #14
0
        float radius; //frame radius

        #endregion Fields

        #region Constructors

        public CircularFrame(Vector3D center, float radius, Plane plane)
        {
            this.A = center;
            this.plane = plane;
            this.radius = radius;
        }
コード例 #15
0
 public Ray(Vector3D origin, Vector3D direction, SceneObject objectAtEmission)
 {
     this.origin = origin;
     this.direction = direction;
     this.emissionObject = objectAtEmission;
 }
コード例 #16
0
 public override Vector3D GetNormalAtPoint(Vector3D point)
 {
     return plane.GetNormalAtPoint(point);
 }
コード例 #17
0
 public Sphere(float radius, Vector3D center)
 {
     this.radius = radius;
     this.center = center;
 }