Esempio n. 1
0
        public Sphere(Vect3 position, Vect3 lookAt, double rotationRad, Color color) : base(position, lookAt)
        {
            Color  = color;
            Radius = lookAt.Length();

            // calculate the rotation of the 0-meridian
            RotVect = lookAt;

            // check so we don't end up with two linear dependent vectors
            if (System.Math.Abs(RotVect.Y) > Constants.EPS &&
                System.Math.Abs(RotVect.X) < Constants.EPS &&
                System.Math.Abs(RotVect.Z) < Constants.EPS)
            {
                RotVect.X += 1;
            }
            else
            {
                RotVect.Y += 1;
            }
            RotVect = RotVect.CrossProduct(lookAt).Normalize();
            LookAt  = LookAt.Normalize();
            Rotate(lookAt, rotationRad);
        }
Esempio n. 2
0
 public virtual double GetReflectivityAt(Vect3 hitPoint)
 {
     return Reflectivity;
 }
Esempio n. 3
0
 public override bool Contains(Vect3 hitPoint)
 {
     throw new Exception("Not supported yet.");
 }
Esempio n. 4
0
 public Plane(Vect3 position, Vect3 normal) : base(position, normal)
 {
     LookAt = LookAt.Normalize();
 }
Esempio n. 5
0
 public override bool IsEnclosedByCube(Vect3 bcenter, double w2)
 {
     return(CubeCone.IsCubeEnclosingCone(bcenter, w2, Position, LookAt, AxisLength, CosPhi));
 }
Esempio n. 6
0
 public override bool Contains(Vect3 hitPoint)
 {
     return(System.Math.Abs(hitPoint.Distance(Position) - Radius) < Constants.EPS);
 }
Esempio n. 7
0
 public Sphere(Vect3 position, double radius, Color color)
     : this(position, radius, color, 0)
 {
 }
Esempio n. 8
0
 public bool Equals(Vect3 v, double eps = Constants.EPS)
 {
     return(System.Math.Abs(X - v.X) < eps &&
            System.Math.Abs(Y - v.Y) < eps &&
            System.Math.Abs(Z - v.Z) < eps);
 }
Esempio n. 9
0
 public TexturedSphere(Vect3 position, double radius, double rotation, String imagePath)
     : this(position, radius, rotation, new Color(), 0, imagePath)
 {
 }
Esempio n. 10
0
        private Color GetTextureColorAt(Vect3 hitPoint)
        {
            Vect3 texcoord = Vect3Extensions.InterpolateTriangle(Position, V2, V3, _t1, _t2, _t3, hitPoint);

            return(_texture.GetColorAt(texcoord));
        }
Esempio n. 11
0
 public void CopyDataTo(ref Vect3 other)
 {
     other.X = X;
     other.Y = Y;
     other.Z = Z;
 }
Esempio n. 12
0
 public abstract Vect3 GetNormalAt(Vect3 hitPoint);
Esempio n. 13
0
 public abstract bool Contains(Vect3 hitPoint);
Esempio n. 14
0
        public virtual bool IsEnclosedByCube(Vect3 cCenter, double cWidthHalf)
        {
            Sphere s = GetBoundingSphere();

            return CubeSphere.IsSphereEnclosedByCube(cCenter, cWidthHalf, s.Position, s.Radius);
        }
Esempio n. 15
0
 public override Vect3 GetNormalAt(Vect3 hitPoint)
 {
     return(hitPoint * -1); // the normal is everywhere the vect pt -> 0
 }
Esempio n. 16
0
 public TexturedSphere(Vect3 position, Vect3 lookAt, double rotation, String imagePath)
     : this(position, lookAt, rotation, new Color(), 0, imagePath)
 {
 }
Esempio n. 17
0
 public override bool Contains(Vect3 hitPoint)
 {
     return(false);
 }
Esempio n. 18
0
 public TexturedSphere(Vect3 position, Vect3 lookAt, double rotation, Color color, double reflectivity,
                       String imagePath)
     : base(position, lookAt, rotation, color, reflectivity)
 {
     _texture = Texture.Load(imagePath);
 }
Esempio n. 19
0
 public Sphere(Vect3 position, Vect3 lookAt, double rotationRad, Color color, double reflectivity)
     : this(position, lookAt, rotationRad, color)
 {
     Reflectivity = reflectivity;
 }
Esempio n. 20
0
 public new Color GetColorAt(Vect3 hitPoint)
 {
     return(GetTextureColorAt(hitPoint).MixSurfaceSurface(Color));
 }
Esempio n. 21
0
        public override Vect3 GetNormalAt(Vect3 hitPoint)
        {
            Vect3 tmp = hitPoint - Position;

            return(tmp.Normalize());
        }
Esempio n. 22
0
        public new double GetReflectivityAt(Vect3 hitPoint)
        {
            double alpha = GetTextureColorAt(hitPoint).A / 256.0;

            return((1 - alpha) * Reflectivity);
        }
Esempio n. 23
0
 public override bool Contains(Vect3 hitPoint)
 {
     throw new Exception("not implemented");
 }
Esempio n. 24
0
 public Basic3DObjectStructure(Vect3 position, Vect3 lookAt, I3DObject[] objects)
     : base(position, lookAt)
 {
     _objects = objects;
 }
Esempio n. 25
0
 public Plane(Vect3 position, Vect3 normal, Color color)
     : this(position, normal)
 {
     Color = color;
 }
Esempio n. 26
0
 protected I3DObject GetObjectAt(Vect3 hitPoint)
 {
     return(_objects.FirstOrDefault(o3D => o3D.Contains(hitPoint)));
 }
Esempio n. 27
0
 public override Vect3 GetNormalAt(Vect3 hitPoint)
 {
     return(LookAt);
 }
Esempio n. 28
0
 public override bool Contains(Vect3 hitPoint)
 {
     return(_objects.Any(o3D => o3D.Contains(hitPoint)));
 }
Esempio n. 29
0
 public Plane(Vect3 position, Vect3 normal, Color color, double reflectivity)
     : this(position, normal)
 {
     Color        = color;
     Reflectivity = reflectivity;
 }
Esempio n. 30
0
 public virtual Color GetColorAt(Vect3 hitPoint)
 {
     return Color;
 }