示例#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);
        }
示例#2
0
 public virtual double GetReflectivityAt(Vect3 hitPoint)
 {
     return Reflectivity;
 }
示例#3
0
 public override bool Contains(Vect3 hitPoint)
 {
     throw new Exception("Not supported yet.");
 }
示例#4
0
 public Plane(Vect3 position, Vect3 normal) : base(position, normal)
 {
     LookAt = LookAt.Normalize();
 }
示例#5
0
文件: Cone.cs 项目: FrankyBoy/JRayX
 public override bool IsEnclosedByCube(Vect3 bcenter, double w2)
 {
     return(CubeCone.IsCubeEnclosingCone(bcenter, w2, Position, LookAt, AxisLength, CosPhi));
 }
示例#6
0
 public override bool Contains(Vect3 hitPoint)
 {
     return(System.Math.Abs(hitPoint.Distance(Position) - Radius) < Constants.EPS);
 }
示例#7
0
 public Sphere(Vect3 position, double radius, Color color)
     : this(position, radius, color, 0)
 {
 }
示例#8
0
文件: Vect3.cs 项目: FrankyBoy/JRayX
 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);
 }
示例#9
0
 public TexturedSphere(Vect3 position, double radius, double rotation, String imagePath)
     : this(position, radius, rotation, new Color(), 0, imagePath)
 {
 }
示例#10
0
        private Color GetTextureColorAt(Vect3 hitPoint)
        {
            Vect3 texcoord = Vect3Extensions.InterpolateTriangle(Position, V2, V3, _t1, _t2, _t3, hitPoint);

            return(_texture.GetColorAt(texcoord));
        }
示例#11
0
文件: Vect3.cs 项目: FrankyBoy/JRayX
 public void CopyDataTo(ref Vect3 other)
 {
     other.X = X;
     other.Y = Y;
     other.Z = Z;
 }
示例#12
0
 public abstract Vect3 GetNormalAt(Vect3 hitPoint);
示例#13
0
 public abstract bool Contains(Vect3 hitPoint);
示例#14
0
        public virtual bool IsEnclosedByCube(Vect3 cCenter, double cWidthHalf)
        {
            Sphere s = GetBoundingSphere();

            return CubeSphere.IsSphereEnclosedByCube(cCenter, cWidthHalf, s.Position, s.Radius);
        }
示例#15
0
文件: Sky.cs 项目: FrankyBoy/JRayX
 public override Vect3 GetNormalAt(Vect3 hitPoint)
 {
     return(hitPoint * -1); // the normal is everywhere the vect pt -> 0
 }
示例#16
0
 public TexturedSphere(Vect3 position, Vect3 lookAt, double rotation, String imagePath)
     : this(position, lookAt, rotation, new Color(), 0, imagePath)
 {
 }
示例#17
0
文件: Sky.cs 项目: FrankyBoy/JRayX
 public override bool Contains(Vect3 hitPoint)
 {
     return(false);
 }
示例#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);
 }
示例#19
0
 public Sphere(Vect3 position, Vect3 lookAt, double rotationRad, Color color, double reflectivity)
     : this(position, lookAt, rotationRad, color)
 {
     Reflectivity = reflectivity;
 }
示例#20
0
 public new Color GetColorAt(Vect3 hitPoint)
 {
     return(GetTextureColorAt(hitPoint).MixSurfaceSurface(Color));
 }
示例#21
0
        public override Vect3 GetNormalAt(Vect3 hitPoint)
        {
            Vect3 tmp = hitPoint - Position;

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

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