Пример #1
0
 // Constructor
 public Circle(Vector3D center, double radius)
     : base(center)
 {
     this.Radius = radius;
     A = new Vector3D(center.X + this.Radius, center.Y, center.Z);
     B = new Vector3D(center.X, center.Y + this.Radius, center.Z);
 }
Пример #2
0
 public void Translate(Vector3D translationVector)
 {
     for (int i = 0; i < this.vertices.Count; i++)
     {
         this.vertices[i] += translationVector;
     }
 }
Пример #3
0
        public static Vector3D CrossProduct(Vector3D a, Vector3D b)
        {
            double crossX = a.Y * b.Z - a.Z * b.Y;
            double crossY = a.Z * b.X - a.X * b.Z;
            double crossZ = a.X * b.Y - a.Y * b.X;

            return new Vector3D(crossX, crossY, crossZ);
        }
Пример #4
0
 public Vector3D GetNormal()
 {
     Vector3D center = this.GetCenter();
     Vector3D A = new Vector3D(center.X + this.Radius, center.Y, center.Z);
     Vector3D B = new Vector3D(center.X, center.Y + this.Radius, center.Z);
     Vector3D normal = Vector3D.CrossProduct(center - A, center - B);
     normal.Normalize();
     return normal;
 }
Пример #5
0
 public void Scale(Vector3D scaleCenter, double scaleFactor)
 {
     for (int i = 0; i < this.vertices.Count; i++)
     {
         Vector3D centeredCurrent = this.vertices[i] - scaleCenter;
         Vector3D scaledCenteredCurrent = centeredCurrent * scaleFactor;
         this.vertices[i] = scaledCenteredCurrent + scaleCenter;
     }
 }
Пример #6
0
        public static double DotProduct(Vector3D a, Vector3D b)
        {
            double result = 0;
            for (int d = 0; d < 3; d++)
            {
                result += a[d] * b[d];
            }

            return result;
        }
Пример #7
0
        // Methods
        public virtual Vector3D GetCenter()
        {
            Vector3D verticesSum = new Vector3D(0, 0, 0);

            for (int i = 0; i < this.vertices.Count; i++)
            {
                verticesSum += this.vertices[i];
            }

            return verticesSum / this.vertices.Count;
        }
Пример #8
0
        public void RotateInXY(Vector3D rotCenter, double angleDegrees)
        {
            for (int i = 0; i < this.vertices.Count; i++)
            {
                Vector3D centeredCurrent = this.vertices[i] - rotCenter;
                double angleRads = angleDegrees * Math.PI / 180.0;

                Vector3D rotatedCenteredCurrent = new Vector3D(
                    centeredCurrent.X * Math.Cos(angleRads) - centeredCurrent.Y * Math.Sin(angleRads),
                    centeredCurrent.X * Math.Sin(angleRads) + centeredCurrent.Y * Math.Cos(angleRads),
                    centeredCurrent.Z);

                this.vertices[i] = rotatedCenteredCurrent + rotCenter;
            }
        }
Пример #9
0
 public Cylinder(Vector3D botCirc, Vector3D topCirc, double radius)
     : base(botCirc, topCirc)
 {
     this.Radius = radius;
 }
Пример #10
0
 public Cylinder(Vector3D centerBottom, Vector3D centerTop, double radius)
     : base(centerBottom, centerTop)
 {
     this.Radius = radius;
 }
Пример #11
0
 public Circle(Vector3D center, double radius)
     : base(center)
 {
     this.Radisu = radius;
 }
Пример #12
0
 public Vertex(Vector3D location)
     : base(location)
 {
 }
Пример #13
0
 public Triangle(Vector3D a, Vector3D b, Vector3D c)
     : base(a, b, c)
 {
 }
Пример #14
0
        public Cylinder(Vector3D bottomCenter, Vector3D topCenter, double radius)
            : base(topCenter, bottomCenter)
        {
            this.BottomCenter = bottomCenter;
            this.TopCenter = topCenter;
            this.Radius = radius;

            this.Height = (topCenter - bottomCenter).Magnitude;
        }
Пример #15
0
 public Circle(Vector3D centre, double radius)
     : base(centre)
 {
     this.Radius = radius;
 }
Пример #16
0
 public Vector3D GetNormal()
 {
     Vector3D normal = new Vector3D(0, 0, 1);
     return normal;
 }
Пример #17
0
 public Circle(Vector3D vector, double radius)
     : base(vector)
 {
     this.Radius = radius;
 }
Пример #18
0
 public Cylinder(Vector3D bottomCenter, Vector3D topCenter, double radius)
     : base(bottomCenter, topCenter)
 {
     this.Radius = radius;
 }
Пример #19
0
 public Cylinder(Vector3D a, Vector3D b, double r)
     : base(a, b)
 {
     this.Radius = r;
 }
Пример #20
0
 public Circle(Vector3D a, double r)
     : base(a)
 {
     this.Radius = r;
 }
 public Cylinder(Vector3D bottom, Vector3D top, double radius)
     : base(bottom, top)
 {
     this.Radius = radius;
 }
Пример #22
0
 public Circle(Vector3D location, double radius)
     : base(location)
 {
     this.Radius = radius;
 }
Пример #23
0
 public Cylinder(Vector3D top, Vector3D bottom, double radius)
     : base(top, bottom)
 {
     this.Radius = radius;
 }
Пример #24
0
 public Cylinder(Vector3D bottomLocation, Vector3D topLocation, double radius)
     : base(bottomLocation, topLocation)
 {
     this.Radius = radius;
     this.Height = new Vector3D((topLocation.X - bottomLocation.X), (topLocation.Y - bottomLocation.Y), (topLocation.Z - bottomLocation.Z)).Magnitude;
 }
Пример #25
0
 public LineSegment(Vector3D a, Vector3D b)
     : base(a, b)
 {
     this.length = (this.A - this.B).Magnitude;
 }
Пример #26
0
 public Cylinder(Vector3D center, Vector3D height, double radius)
     : base(center,height)
 {
     this.Radius = radius;
 }
Пример #27
0
 public static double GetAngleDegrees(Vector3D a, Vector3D b)
 {
     return Math.Acos(Vector3D.DotProduct(a, b) / a.Magnitude * b.Magnitude);
 }
Пример #28
0
 //
 public Circle(Vector3D center, double radius)
     : base(center)
 {
     //
     this.Radius = radius;                                           //
 }
Пример #29
0
 public Circle(Vector3D center, double radius)
     : base(center)
 {
     this.Center = center;
     this.Radius = radius;
 }
Пример #30
0
 public Circle(Vector3D c, double r)
     : base(c)
 {
     this.Radius = r;
 }