Ejemplo n.º 1
0
 internal static Triangle getAdjacentTri(TEDictionary ted, Triangle tri, Edge e)
 {
     try
     {
         List <int> indexs;
         bool       found = ted.EdgeDic.TryGetValue(e, out indexs);
         if (!found)
         {
             return(null);
         }
         Triangle r = null;
         for (int i = 0; i < indexs.Count; i++)
         {
             r = ted.TriangleList[indexs[i]];
             if (r != tri)
             {
                 return(r);
             }
         }
     }
     catch (System.Exception ex)
     {
     }
     return(null);
 }
Ejemplo n.º 2
0
        public void draw()
        {
            ObjectId  layerId = LayerUtil.CreateLayer("coordinate", 0, false);
            Extents3d bounds  = MyDBUtility.getExtents(mydb.getAllLine());

            double zlen = 0;
            double minz = -10;

            if (mydb.TEDicList.Count > 0)
            {
                TEDictionary ted = mydb.TEDicList[0];
                zlen  = ted.maxMaxZ - ted.minMaxZ;
                zlen += 10;
                minz  = ted.minMaxZ - 5;
            }


            Point3d ori = bounds.MinPoint.Add(new Vector3d(-10, -10, 0));

            ori = ori.Add(new Vector3d(0, 0, (minz - ori.Z)));
            double xlen = bounds.MaxPoint.X - bounds.MinPoint.X + 20;
            double ylen = bounds.MaxPoint.Y - bounds.MinPoint.Y + 20;

            MyDBUtility.line(ori, new Point3d(ori.X + xlen, ori.Y, ori.Z), layerId);
            MyDBUtility.line(ori, new Point3d(ori.X, ori.Y + ylen, ori.Z), layerId);
            Point3d zstart = ori.Add(new Vector3d(0, ylen, 0));
            Point3d zend   = zstart.Add(new Vector3d(0, 0, zlen));

            MyDBUtility.line(zstart, zend, layerId);
            int xcount = (int)xlen / 10;
            int ycount = (int)ylen / 10;
            int zcount = (int)zlen / 5;

            for (int i = 0; i < xcount; i++)
            {
                Point3d s = ori.Add(new Vector3d(i * 10, 0, 0));
                Point3d e = s.Add(new Vector3d(0, -5, 0));
                MyDBUtility.line(s, e, layerId);
                MyDBUtility.text(e, ((int)s.X).ToString(), -Math.PI / 2, layerId);
            }
            for (int i = 0; i < ycount; i++)
            {
                Point3d s = ori.Add(new Vector3d(0, i * 10, 0));
                Point3d e = s.Add(new Vector3d(-5, 0, 0));
                MyDBUtility.line(s, e, layerId);
                MyDBUtility.text(e.Add(new Vector3d(-5, 0, 0)), ((int)s.Y).ToString(), 0, layerId);
            }

            for (int i = 0; i < zcount; i++)
            {
                Point3d s = ori.Add(new Vector3d(0, ylen, i * 5));
                Point3d e = s.Add(new Vector3d(0, 5, 0));
                MyDBUtility.line(s, e, layerId);
                MyDBUtility.text(e.Add(new Vector3d(0, 10, 0)), ((int)s.Z).ToString(), 0, layerId);
            }
        }
Ejemplo n.º 3
0
        public void contour()
        {
            this.contColorize = new ContourColorize2();
            TEDictionary ted = mydb.TEDicList[mydb.Resolution];
            //ted.maxCZ - ted.minCZ;
            //double start=ted.minMinZ-10;
            //double end = ted.maxMaxZ + 10;
            double start = -10 * mydb.tcSetting.Scale.Z;
            double end   = 10 * mydb.tcSetting.Scale.Z;

            start = Math.Min(start, ted.minMinZ - 10);
            end   = Math.Max(end, ted.maxMaxZ + 10);
            double space = mydb.tcSetting.ContourSpace;

            BASE.ContourLineComputation cont = new BASE.ContourLineComputation();
            cont.Contour(this, "W", start, end /*10 * mydb.tcSetting.Scale.Z*/, space, "E", "Contour_line_");
        }
Ejemplo n.º 4
0
        public void setTris(List <Triangle> tris)
        {
            /* List<MyTriangle> myTri = new List<MyTriangle>();
             * for (int i = 0; i < tris.Count; i++)
             * {
             *   myTri.Add(new MyTriangle(tris[i]));
             * }*/
            //this.TrianglesList[this.Resolution ] = myTri;
            TEDictionary ppd = new TEDictionary();

            ppd.Add(tris);
            //ppd.Distinct();
            ppd.genIndex();
            if (TEDicList.Count - 1 < this.Resolution)
            {
                TEDicList.Add(ppd);
            }
            else
            {
                this.TEDicList[this.Resolution] = ppd;
            }
        }
Ejemplo n.º 5
0
        public static PointSet interpolation_partial(TEDictionary ppd)
        {
            PointSet result = new PointSet();
            int      count  = ppd.TriangleList.Count;
            List <InterpolatedPoint> lip = new List <InterpolatedPoint>();

            for (int i = 0; i < count; i++)
            {
                Triangle t = ppd.TriangleList[i];
                List <InterpolatedPoint> tps = interp2(ppd, t);
                if (tps != null)
                {
                    lip.AddRange(tps);
                }
            }
            lip.Sort(new InterpolatedPointComparer());
            count = lip.Count / 5;
            for (int i = 0; i < count; i++)
            {
                result.Add(lip[i].point);
            }
            return(result);
        }
Ejemplo n.º 6
0
        public static List <InterpolatedPoint> interp2(TEDictionary ted, Triangle tri)
        {
            List <InterpolatedPoint> r = new List <InterpolatedPoint>();

            Autodesk.AutoCAD.Geometry.Vector3d totalMoveV = new Autodesk.AutoCAD.Geometry.Vector3d();
            List <Movement4> moveList = new List <Movement4>();
            Point            center   = tri.Center;

            for (int i = 0; i < 3; i++)
            {
                Edge     commonEdge  = tri.Edges[i];
                Triangle adjacentTri = getAdjacentTri(ted, tri, commonEdge);
                if (adjacentTri == null)
                {
                    continue;
                }
                Movement4 moveV = getMoveVector(tri, adjacentTri, commonEdge);
                moveList.Add(moveV);
            }
            double totalLength = 0;

            for (int i = 0; i < moveList.Count; i++)
            {
                totalLength += moveList[i].dis;
            }

            for (int i = 0; i < moveList.Count; i++)
            {
                totalMoveV += moveList[i].move * totalLength;
            }

            Point movedP = center.Move(new ngeometry.VectorGeometry.Vector3d(totalMoveV.X, totalMoveV.Y, totalMoveV.Z));

            r.Add(new InterpolatedPoint(totalMoveV.Length, movedP));
            return(r);
        }