コード例 #1
0
        public Location getRefinedMinPoint()
        {
            Location min = this.min.clone();

            min.setX(min.getX() * this.getModel().getScaleX());
            min.setY(min.getY() * this.getModel().getScaleY());
            min.setZ(min.getZ() * this.getModel().getScaleZ());
            min.setOwner(this.getModel().getLocation());
            return(min);
        }
コード例 #2
0
        public Location[] getAbsoluteMinMaxPoints()
        {
            /*
             * This will check children for their min X Y and Z values RELATIVE TO THIS OBJECT
             * THE RETURNED VALUE WILL BE RELATIVE TO THIS OBJECT, EXAMPLE;
             * THIS OBJECT IS AT 14, 14, 14
             * THIS MIN POINT IS -4, -2, -4 (MAKING ITS ABS POSITION AT 10, 12, 10)
             * THE CHILD IS AT 3, 3, 3 OF THIS, MAKING ITS ABS 17, 17, 17
             * THE CHILD MIN POINT IS -6, -6, -6 OF IT, MAKING ITS POSITION RELATIVE TO ITS OBJECT -3, -3, -3
             * THAT MAKES THE RELATAIVE MIN POINT -4, -3, -4 (X FROM THIS MIN, Y FROM CHILD MIN, Z FROM THIS MIN)
             * THAT MAKES THE ABSOLUTE MIN POINT AT 10, 11, 10
             *
             * RETURNS ARRAY TO INCREASE EFFICIENCY, BE SURE TO DISPOSE BOTH
             * getAbsoluteMinMaxPoints()[0] = min_point;
             * getAbsoluteMinMaxPoints()[1] = max_point;
             */
            double minX = (this.min == null ? 0 : this.min.getX());
            double minY = (this.min == null ? 0 : this.min.getY());
            double minZ = (this.min == null ? 0 : this.min.getZ());
            double maxX = (this.max == null ? 0 : this.max.getX());
            double maxY = (this.max == null ? 0 : this.max.getY());
            double maxZ = (this.max == null ? 0 : this.max.getZ());

            foreach (Model child in this.children)
            {
                Location[] minMaxPoints = child.getAbsoluteMinMaxPoints();
                Location   minPoint     = minMaxPoints[0];
                Location   maxPoint     = minMaxPoints[1];
                minPoint.add(child.getLocation());
                maxPoint.add(child.getLocation());
                //COMPARE VALUES
                if (minPoint.getX() < minX)
                {
                    minX = minPoint.getX();
                }
                if (minPoint.getY() < minY)
                {
                    minY = minPoint.getY();
                }
                if (minPoint.getZ() < minZ)
                {
                    minZ = minPoint.getZ();
                }
                //MAX VALUES
                if (maxPoint.getX() > maxX)
                {
                    maxX = maxPoint.getX();
                }
                if (maxPoint.getY() > maxY)
                {
                    maxY = maxPoint.getY();
                }
                if (maxPoint.getZ() > maxZ)
                {
                    maxZ = maxPoint.getZ();
                }

                //Clean.. soo clean
                minPoint.Dispose();
                maxPoint.Dispose();
            }
            Location aMinPoint = new Location(minX, minY, minZ);
            Location aMaxPoint = new Location(maxX, maxY, maxZ);

            return(new Location[] { aMinPoint, aMaxPoint });
        }
コード例 #3
0
 public void scale(double amt)
 {
     min.setX(min.getX() * amt).setY(min.getY() * amt).setZ(min.getZ() * amt);
     max.setX(max.getX() * amt).setY(max.getY() * amt).setZ(max.getZ() * amt);
 }
コード例 #4
0
ファイル: Vertice.cs プロジェクト: YourWishes/FaultEnginev3
 public Vertice(Location l) : this()
 {
     this.x = l.getX();
     this.y = l.getY();
     this.z = l.getZ();
 }