Example #1
0
        public IVolume AddPlan(Vector3 start, Vector3 end)
        {
            IVolume    output   = AddPlan(NewPlan());
            Vector3    goPos    = transformposition;
            Quaternion goInvRot = Quaternion.Inverse(transformrotation);

            output.AddPoint(goInvRot * (new Vector3(end.x, 0, start.z) - goPos));
            output.AddPoint(goInvRot * (new Vector3(start.x, 0, start.z) - goPos));
            output.AddPoint(goInvRot * (new Vector3(start.x, 0, end.z) - goPos));
            output.AddPoint(goInvRot * (new Vector3(end.x, 0, end.z) - goPos));
            return(output);
        }
Example #2
0
        public IVolume AddPlan(Rect rect)
        {
            IVolume    output   = AddPlan(NewPlan());
            Vector3    goPos    = transformposition;
            Quaternion goInvRot = Quaternion.Inverse(transformrotation);

            output.AddPoint(goInvRot * (new Vector3(rect.xMin, 0, rect.yMin) - goPos));
            output.AddPoint(goInvRot * (new Vector3(rect.xMax, 0, rect.yMin) - goPos));
            output.AddPoint(goInvRot * (new Vector3(rect.xMax, 0, rect.yMax) - goPos));
            output.AddPoint(goInvRot * (new Vector3(rect.xMin, 0, rect.yMax) - goPos));
            return(output);
        }
Example #3
0
        public IVolume AddPlan(Vector3 position, float size, IVolume abovePlan = null)
        {
            IVolume    output   = AddPlan(NewPlan(), abovePlan);
            Vector3    goPos    = transformposition;
            Quaternion goInvRot = Quaternion.Inverse(transformrotation);

            output.AddPoint(goInvRot * (position - new Vector3(-0.5f, 0, -0.5f) * size - goPos));
            output.AddPoint(goInvRot * (position - new Vector3(0.5f, 0, -0.5f) * size - goPos));
            output.AddPoint(goInvRot * (position - new Vector3(0.5f, 0, 0.5f) * size - goPos));
            output.AddPoint(goInvRot * (position - new Vector3(-0.5f, 0, 0.5f) * size - goPos));
            return(output);
        }
Example #4
0
        public IVolume AddPlan(Rect rect)
        {
            Debug.Log("AddPlan(Rect rect) rect.x=" + rect.x + "  rect.y=" + rect.y + "  rect.width=" + rect.width + " rect.h=" + rect.height);
            IVolume    output   = AddPlan(NewPlan());
            Vector3    goPos    = transform.position;
            Quaternion goInvRot = Quaternion.Inverse(transform.rotation);

            output.AddPoint(goInvRot * (new Vector3(rect.xMin, 0, rect.yMin) - goPos));
            output.AddPoint(goInvRot * (new Vector3(rect.xMax, 0, rect.yMin) - goPos));
            output.AddPoint(goInvRot * (new Vector3(rect.xMax, 0, rect.yMax) - goPos));
            output.AddPoint(goInvRot * (new Vector3(rect.xMin, 0, rect.yMax) - goPos));
            return(output);
        }
Example #5
0
        public IVolume AddPlan(Vector2Int[] points, IVolume abovePlan = null)
        {
            IVolume    output     = NewPlan();
            Vector3    goPos      = transformposition;
            Quaternion goInvRot   = Quaternion.Inverse(transformrotation);
            int        pointCount = points.Length;

            for (int p = 0; p < pointCount; p++)
            {
                output.AddPoint(goInvRot * (points[p].vector3XZ - goPos));
            }
            return(AddPlan(output, abovePlan));
        }
Example #6
0
        public IVolume AddPlan(List <Vector2> points, IVolume abovePlan = null)
        {
            IVolume    output     = NewPlan();
            Vector3    goPos      = transformposition;
            Quaternion goInvRot   = Quaternion.Inverse(transformrotation);
            int        pointCount = points.Count;

            for (int p = 0; p < pointCount; p++)
            {
                Vector3 pV3 = new Vector3(points[p].x, 0, points[p].y);
                output.AddPoint(goInvRot * (pV3 - goPos));
            }
            return(AddPlan(output, abovePlan));
        }
Example #7
0
        public IVolume AddPlan(Vector2Int[] points, IVolume abovePlan = null)
        {
            IVolume    output     = NewPlan();
            Vector3    goPos      = transform.position;
            Quaternion goInvRot   = Quaternion.Inverse(transform.rotation);
            int        pointCount = points.Length;

            if (!BuildrPolyClockwise.Check(points))
            {
                Array.Reverse(points);
            }
            for (int p = 0; p < pointCount; p++)
            {
                output.AddPoint(goInvRot * (points[p].vector3XZ - goPos));
            }
            return(AddPlan(output, abovePlan));
        }
Example #8
0
        public IVolume AddPlan(IntPoint[] points, IVolume abovePlan = null, float scale = 100)
        {
            IVolume    output     = AddPlan(NewPlan(), abovePlan);
            int        pointCount = points.Length;
            Vector3    goPos      = transformposition;
            Quaternion goInvRot   = Quaternion.Inverse(transformrotation);

            for (int p = 0; p < pointCount; p++)
            {
                Vector3    v3    = goInvRot * (new Vector3(points[p].X / scale, 0, points[p].Y / scale) - goPos);
                Vector2Int v2Int = new Vector2Int(v3.x, v3.z);
                if (output.Contains(v2Int))
                {
                    continue;
                }
                output.AddPoint(v2Int);
            }
            return(output);
        }