public Vector4D(Vector3D v) { this.x = v.X; this.y = v.Y; this.z = v.Z; this.t = 1f; }
public Camera(float alpha, float beta, float zoom, Vector3D position) { this.alpha = alpha; this.beta = beta; this.position = position; this.forward = ComputeForward(); }
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); }
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} }); }
public virtual Vector3D GetNormalAtPoint(Vector3D point) { throw new NotImplementedException(); }
public override Vector3D GetNormalAtPoint(Vector3D point) { return Vector3D.Zero; }
public Ray(Vector3D origin, Vector3D direction) { this.origin = origin; this.direction = direction; this.emissionObject = SceneObject.Air; }
public override Vector3D GetNormalAtPoint(Vector3D point) { return (point - center).Unit; }
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); }
public Light(Vector3D position) { this.position = position; }
public Color(float r, float g, float b) { this.color = new Vector3D(r, g, b); }
public Color(Vector3D color) { this.color = color; }
Vector3D p; //a point of the plane #endregion Fields #region Constructors public Plane(Vector3D p, Vector3D n) { this.p = p; this.n = n.Unit; }
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; }
public Ray(Vector3D origin, Vector3D direction, SceneObject objectAtEmission) { this.origin = origin; this.direction = direction; this.emissionObject = objectAtEmission; }
public override Vector3D GetNormalAtPoint(Vector3D point) { return plane.GetNormalAtPoint(point); }
public Sphere(float radius, Vector3D center) { this.radius = radius; this.center = center; }