Пример #1
0
        public bool CanMoveTo(double x, double y, double z)
        {
            double origX = this.x;
            double origY = this.y;
            double origZ = this.z;

            bool res = true;

            this.x = x; this.y = y; this.z = z;

            if (Tetrahedrons.Any(t => !t.CheckVolume()))
            {
                res = false;
            }

            this.x = origX;
            this.y = origY;
            this.z = origZ;

            return(res);
        }
Пример #2
0
        public bool CanMoveTo(Point p1, IEnumerable <Tetrahedron> exceptTetras, double tolerance = 0.001d)
        {
            double origX = this.x;
            double origY = this.y;
            double origZ = this.z;

            bool res = true;

            this.x = p1.X; this.y = p1.Y; this.z = p1.Z;

            if (Tetrahedrons.Except(exceptTetras).Any(t => !t.CheckVolume(tolerance)))
            {
                res = false;
            }

            this.x = origX;
            this.y = origY;
            this.z = origZ;

            return(res);
        }
Пример #3
0
        public bool MoveTo(double x, double y, double z, bool safe)
        {
            if (!safe)
            {
                this.x = x; this.y = y; this.z = z;

                return(true);
            }
            else
            {
                double origX = this.x;
                double origY = this.y;
                double origZ = this.z;

                this.x = x; this.y = y; this.z = z;

                int p = 0;
                while (p < 20 && Tetrahedrons.Any(t => !t.CheckVolume()))
                {
                    this.x = origX + 0.9 * (this.x - origX);
                    this.y = origY + 0.9 * (this.y - origY);
                    this.z = origZ + 0.9 * (this.z - origZ);

                    p++;
                }

                if (p == 20)
                {
                    this.x = origX;
                    this.y = origY;
                    this.z = origZ;
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
        }