示例#1
0
 public static Point3D operator + (Point3D p1, Point3D p2) 
 {
     Point3D p3 =new Point3D(0,0,0);
     p3._x = p1._x + p2._x;
     p3._y = p1._y + p2._y;
     p3._z = p1._z + p2._z;
     return p3;
 }
示例#2
0
 public Point3D Equals (Point3D p) 
 {
     if (this != p) 
     {
         _x = p._x;
         _y = p._y;
         _z = p._z;
     } 
     else 
     {
         //cout << "Error: copying point into itself!" << endl;
     }
     return (this);
 }
示例#3
0
 public LineSeg3D Subtract (LineSeg3D line, Point3D point)
 {
     LineSeg3D l = new LineSeg3D();
     l.Equals(line);
     l -= point;
     return l;
 }
示例#4
0
 public LineSeg3D()
 {
     // Nothing much to create...
     _sp = new Point3D(0,0,0);
     _ep = new Point3D(0,0,0);
 }
示例#5
0
 public static Point3D operator * (MatrixFixed M, Point3D p1) 
 {
     Point3D p3 = new Point3D(0,0,0);
     p3._x = M[0,0]*p1._x + M[0,1]*p1._y + M[0,2]*p1._z;
     p3._y = M[1,0]*p1._x + M[1,1]*p1._y + M[1,2]*p1._z;
     p3._z = M[2,0]*p1._x + M[2,1]*p1._y + M[2,2]*p1._z;
     return p3;
 }
示例#6
0
 public LineSeg3D Add (LineSeg3D line, Point3D point)
 {
     LineSeg3D l = new LineSeg3D();
     l.Equals(line);
     l += point;
     return l;
 }
示例#7
0
 public void SetEndPoint(Point3D p)
 {
     _ep = p;
 }
示例#8
0
 public Quaternion(Point3D axis)
 {
     Set(axis, 0);
 }
示例#9
0
 public LineSeg3D Equals (LineSeg3D ls) 
 {
     if (this != ls) 
     {
         _sp = ls._sp;
         _ep = ls._ep;
     } 
     else 
     {
         Debug.WriteLine("Error: copying LineSeg3D into itself!");
     }
     return this;
 }
示例#10
0
	    public static Point3D VectorProduct(Point3D p1, Point3D p2)
	    {
	        return(new Point3D(p1._y*p2._z - p1._z*p2._y,
				 p1._z*p2._x - p1._x*p2._z,
				 p1._x*p2._y - p1._y*p2._x));
	    }
示例#11
0
 public Vector3D(Point3D p) : base(p)
 {
     // move along, nothing to see...
 }
示例#12
0
 public Point3D(Point3D p)
 {
     this.Equals(p);
 }
示例#13
0
        public float GetDistance(Point3D testpoint) 
        {
            return (float)Math.Sqrt((testpoint._x - _x) * (testpoint._x - _x) + 
		               (testpoint._y - _y)*(testpoint._y - _y) + 
		               (testpoint._z - _z)*(testpoint._z - _z));
        }		  
示例#14
0
	    public float ScalarTripleProduct(Point3D p1, 
					  Point3D p2, 
					  Point3D p3)
	    {
	        float result=0;
	        result += p1._x * (p2._y*p3._z - p3._y*p2._z);
	        result -= p2._x * (p1._y*p3._z - p3._y*p1._z);
	        result += p3._x * (p1._y*p2._z - p2._y*p1._z);
	        return(result);
	    }
示例#15
0
	    public float ScalarProduct(Point3D p1, Point3D p2)
	    {
	        return(p1._x * p2._x
		           + p1._y * p2._y
		           + p1._z * p2._z);
	    }
示例#16
0
        public LineSeg3D(float x0, float y0, float z0, 
		                 float x1, float y1, float z1)
        {
            // Nothing much to create...
            _sp = new Point3D(x0,y0,z0);
            _ep = new Point3D(x1,y1,z1);
        }
示例#17
0
 public void SetEndPoints(Point3D p0, Point3D p1)
 {
     _sp = p0;
     _ep = p1;
 }
示例#18
0
 public LineSeg3D(Point3D p0, Point3D p1)
 {
     // Nothing much to create...
     _sp = p0;
     _ep = p1;
 }
示例#19
0
 public static Point3D operator / (Point3D p1, float a) 
 {
     Point3D p3 = new Point3D(0,0,0);
     p3._x = p1._x / a;
     p3._y = p1._y / a;
     p3._z = p1._z / a;
     return p3;
 }
示例#20
0
 public void GetEndPoints(Point3D p0, Point3D p1)
 {
     p0 = _sp;
     p1 = _ep;
 }
示例#21
0
 public bool EqualTo (Point3D p) 
 {
     return ((_x == p._x) && (_y == p._y) && (_z == p._z));
 }
示例#22
0
 public void SetStartPoint(Point3D p)
 {
     _sp = p;
 }
示例#23
0
 public bool NotEqualTo (Point3D p) 
 {
     return ((_x != p._x) || (_y != p._y) || (_z != p._z));
 }
示例#24
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="axis">the axis (doesn't need to be a unit vector) around which to rotate</param>
        /// <param name="angle">the rotation angle in radians</param>
        public void Set(Point3D axis, float angle)
        {
            if (Math.Abs(angle) < 1e-8)
            {
                _x = 0.0f;
                _y = 0.0f;
                _z = 0.0f;
                _r = 1.0f;
            }
            else
            {
                float a = angle / 2.0f;  // half angle
                float s = (float)Math.Sin(a);
                float c = (float)Math.Cos(a);

                // Make sure the axis is a unit vector
                float n = 1.0f / axis.Norm();

                _x = s * axis.GetX() * n;  // half angle multiplied with axis
                _y = s * axis.GetY() * n;  // half angle multiplied with axis
                _z = s * axis.GetZ() * n;  // half angle multiplied with axis
                _r = c;                    // real part is cosine of half angle
            }
        }
示例#25
0
 public static Point3D operator - (Point3D p)
 {
     Point3D p2 = new Point3D(-p._x,-p._y,-p._z);
     return(p2);
 }
示例#26
0
 public Quaternion(Point3D axis, float angle)
 {
     Set(axis, angle);
 }
示例#27
0
 public static Point3D operator * (float a, Point3D p1) 
 {
     Point3D p3 = new Point3D(0,0,0);
     p3._x = a*p1._x;
     p3._y = a*p1._y;
     p3._z = a*p1._z;
     return p3;
 }