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); }
public virtual double GetReflectivityAt(Vect3 hitPoint) { return Reflectivity; }
public override bool Contains(Vect3 hitPoint) { throw new Exception("Not supported yet."); }
public Plane(Vect3 position, Vect3 normal) : base(position, normal) { LookAt = LookAt.Normalize(); }
public override bool IsEnclosedByCube(Vect3 bcenter, double w2) { return(CubeCone.IsCubeEnclosingCone(bcenter, w2, Position, LookAt, AxisLength, CosPhi)); }
public override bool Contains(Vect3 hitPoint) { return(System.Math.Abs(hitPoint.Distance(Position) - Radius) < Constants.EPS); }
public Sphere(Vect3 position, double radius, Color color) : this(position, radius, color, 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); }
public TexturedSphere(Vect3 position, double radius, double rotation, String imagePath) : this(position, radius, rotation, new Color(), 0, imagePath) { }
private Color GetTextureColorAt(Vect3 hitPoint) { Vect3 texcoord = Vect3Extensions.InterpolateTriangle(Position, V2, V3, _t1, _t2, _t3, hitPoint); return(_texture.GetColorAt(texcoord)); }
public void CopyDataTo(ref Vect3 other) { other.X = X; other.Y = Y; other.Z = Z; }
public abstract Vect3 GetNormalAt(Vect3 hitPoint);
public abstract bool Contains(Vect3 hitPoint);
public virtual bool IsEnclosedByCube(Vect3 cCenter, double cWidthHalf) { Sphere s = GetBoundingSphere(); return CubeSphere.IsSphereEnclosedByCube(cCenter, cWidthHalf, s.Position, s.Radius); }
public override Vect3 GetNormalAt(Vect3 hitPoint) { return(hitPoint * -1); // the normal is everywhere the vect pt -> 0 }
public TexturedSphere(Vect3 position, Vect3 lookAt, double rotation, String imagePath) : this(position, lookAt, rotation, new Color(), 0, imagePath) { }
public override bool Contains(Vect3 hitPoint) { return(false); }
public TexturedSphere(Vect3 position, Vect3 lookAt, double rotation, Color color, double reflectivity, String imagePath) : base(position, lookAt, rotation, color, reflectivity) { _texture = Texture.Load(imagePath); }
public Sphere(Vect3 position, Vect3 lookAt, double rotationRad, Color color, double reflectivity) : this(position, lookAt, rotationRad, color) { Reflectivity = reflectivity; }
public new Color GetColorAt(Vect3 hitPoint) { return(GetTextureColorAt(hitPoint).MixSurfaceSurface(Color)); }
public override Vect3 GetNormalAt(Vect3 hitPoint) { Vect3 tmp = hitPoint - Position; return(tmp.Normalize()); }
public new double GetReflectivityAt(Vect3 hitPoint) { double alpha = GetTextureColorAt(hitPoint).A / 256.0; return((1 - alpha) * Reflectivity); }
public override bool Contains(Vect3 hitPoint) { throw new Exception("not implemented"); }
public Basic3DObjectStructure(Vect3 position, Vect3 lookAt, I3DObject[] objects) : base(position, lookAt) { _objects = objects; }
public Plane(Vect3 position, Vect3 normal, Color color) : this(position, normal) { Color = color; }
protected I3DObject GetObjectAt(Vect3 hitPoint) { return(_objects.FirstOrDefault(o3D => o3D.Contains(hitPoint))); }
public override Vect3 GetNormalAt(Vect3 hitPoint) { return(LookAt); }
public override bool Contains(Vect3 hitPoint) { return(_objects.Any(o3D => o3D.Contains(hitPoint))); }
public Plane(Vect3 position, Vect3 normal, Color color, double reflectivity) : this(position, normal) { Color = color; Reflectivity = reflectivity; }
public virtual Color GetColorAt(Vect3 hitPoint) { return Color; }