Пример #1
0
 // Adds the point with the size to get another point
 public Point3i add(Point3i pt)
 {
     return new Point3i((int)width+pt.x, (int)height+pt.y, (int)depth+pt.z);
 }
Пример #2
0
        // Gets the maximum value of the point
        public static Point3i max(Point3i value, Point3i max)
        {
            // Variables
            Point3i	temp=	value;

            if(value.x> max.x)
                temp.x=	max.x;
            if(value.y> max.y)
                temp.y=	max.y;
            if(value.z> max.y)
                temp.z=	max.z;

            return temp;
        }
Пример #3
0
        // Gets the minimum value of the point
        public static Point3i min(Point3i value, Point3i min)
        {
            // Variables
            Point3i	temp=	value;

            if(value.x< min.x)
                temp.x=	min.x;
            if(value.y< min.y)
                temp.y=	min.y;
            if(value.z< min.z)
                temp.z=	min.z;

            return temp;
        }
Пример #4
0
        // Clamps the point to the given min and max bounds
        public static Point3i clamp(Point3i value, Point3i min, Point3i max)
        {
            // Variables
            Point3i	temp=	value;

            if(value.x< min.x)
                temp.x=	min.x;
            else if(value.x> max.x)
                temp.x=	max.x;
            if(value.y< min.y)
                temp.y=	min.y;
            else if(value.y> max.y)
                temp.y=	max.y;
            if(value.z< min.z)
                temp.z=	min.z;
            else if(value.z> max.z)
                temp.z=	max.z;

            return temp;
        }
Пример #5
0
        // Gets the most minimum point of the two given points
        public static Point3i getMostMin(Point3i val1, Point3i val2)
        {
            // Variables
            Point3i	pt=	Point3i.ORIGIN;

            if(val1.x< val2.x)
                pt.x=	val1.x;
            else
                pt.x=	val2.x;
            if(val1.y< val2.y)
                pt.y=	val1.y;
            else
                pt.y=	val2.y;
            if(val1.z< val2.z)
                pt.z=	val1.z;
            else
                pt.z=	val2.z;

            return pt;
        }
Пример #6
0
 // Finds if the given 3d point is inside the volume
 public abstract bool contains(ref Point3i pt);
Пример #7
0
 // Subtracts the two points to get a vector pointing in between both
 public Vector3 subtract(Point3i pt)
 {
     return new Vector3((float)(x-pt.x), (float)(y-pt.y), 0f-(float)pt.z);
 }
Пример #8
0
 // Gets the midpoint of the two points
 public Point3f getMidpoint(Point3i pt)
 {
     return new Point3f((x+(float)pt.x)/2f, (y+(float)pt.y)/2f, (z+(float)pt.z)/2f);
 }
Пример #9
0
 // Subtracts the two points to get a vector pointing in between both
 public Vector3 subtract(Point3i pt)
 {
     return new Vector3(x-(float)pt.x, y-(float)pt.y, z-(float)pt.z);
 }
Пример #10
0
 // Finds if the two points are equal
 public bool equals(Point3i pt)
 {
     return (x== pt.x && y== pt.y && z== pt.z);
 }
Пример #11
0
 // Finds if the two points are equal
 public bool equals(Point3i pt)
 {
     return ((int)x== pt.x && (int)y== pt.y && (int)z== pt.z);
 }
Пример #12
0
 // Subtracts the point with the vector to get a new point
 public Point3i subtract(Point3i pt)
 {
     return new Point3i((int)x-pt.x, (int)y-pt.y, 0-pt.z);
 }
Пример #13
0
 // Adds the point with the vector to get a new point
 public Point3i add(Point3i pt)
 {
     return new Point3i((int)x+pt.x, (int)y+pt.y, pt.z);
 }
Пример #14
0
 public virtual bool contains(Point3i pt)
 {
     return contains(ref pt);
 }
Пример #15
0
 // Subtracts the point with the size to get another point
 public Point3i subtract(Point3i pt)
 {
     return new Point3i((int)width-pt.x, (int)height-pt.y, (int)depth-pt.z);
 }
Пример #16
0
 // Gets the midpoint of the two points
 public Point3f getMidpoint(Point3i pt)
 {
     return new Point3f((float)(x+pt.x)/2f, (float)(y+pt.y)/2f, (float)(0+pt.z)/2f);
 }
Пример #17
0
 // Finds if the given 3d point is inside the volume
 public override bool contains(ref Point3i pt)
 {
     return contains((float)pt.x, (float)pt.y);
 }
Пример #18
0
 // Multiples a 3d point to affect it
 public Point3i multiply(Point3i pt)
 {
     return new Point3i
     (
         (int)(xx*pt.x+yx*pt.y+zx*pt.z+ox),
         (int)(xy*pt.x+yy*pt.y+zy*pt.z+oy),
         (int)(xz*pt.x+yz*pt.y+zz*pt.z+oz)
     );
 }