Exemple #1
0
        public static Vector CreateFromTwoPoints(PointInt a, PointInt b)
        {
            var x = b.X - a.X;
            var y = b.Y - a.Y;

            return(new Vector(x, y));
        }
Exemple #2
0
 /// <summary>
 /// 按屏幕上某点缩放地图
 /// </summary>
 /// <param name="mp">屏幕上某点</param>
 /// <param name="n">缩放量(正数表示Zoom增加1,负数表示Zoom减少1)</param>
 public void PointZoom(PointInt mp, int n)
 {
     if (mp != null)
     {
         if (n > 0)
         {
             if (Zoom < MaxZomm)
             {
                 CenterMove((mp.X - ScreenArea.Width / 2) / 2, (mp.Y - ScreenArea.Height / 2) / 2, false);
                 //var mpLatLng = PointToLatLng(mp);
                 this.Zoom++;
                 //GetCenterOfterZoom(mp, mpLatLng);
             }
         }
         else if (n < 0)
         {
             if (Zoom > MinZoom)
             {
                 CenterMove(-(mp.X - ScreenArea.Width / 2), -(mp.Y - ScreenArea.Height / 2), false);
                 //var mpLatLng = PointToLatLng(mp);
                 this.Zoom--;
                 //GetCenterOfterZoom(mp, mpLatLng);
             }
         }
     }
 }
Exemple #3
0
        public static void ContextMenu_DisplayLogout(PointInt p)
        {
            LocalData.bcMenu = new BCMenu()
            {
                ID   = 1,
                Name = "Logout",
            };

            LocalData.bcMenu.Children.Add(new BCMenuItem
            {
                ID   = 1,
                Text = LocalData.uiTranslator.Translate("User Profile"),
            });
            LocalData.bcMenu.Children.Add(new BCMenuItem
            {
                ID   = 2,
                Text = LocalData.uiTranslator.Translate("Logout"),
            });

            //  LocalData.bcMenu.Show();

            LocalData.bcMenu.X = p.X;
            LocalData.bcMenu.Y = p.Y;

            LocalData.bcMenu.width = 50;

            LocalData.bcMenu.height = LocalData.bcMenu.Children.Count * 30 + 12;

            NormalizeContextMenuPosition();


            LocalData.compContextMenu.bcMenu = LocalData.bcMenu;
            LocalData.compContextMenu.Refresh();
        }
Exemple #4
0
 public void Distance(PointInt p1, PointInt p2, long d2, double distance)
 {
     p1.Distance2(p2).Should().Be(d2);
     p2.Distance2(p1).Should().Be(d2);
     p1.Distance(p2).Should().Be(distance);
     p2.Distance(p1).Should().Be(distance);
 }
 public AbstractComponentData GetData()
 {
     if (grid.SelectedCells.Count == 0)
     {
         return(null);
     }
     else if (grid.SelectedCells.Count == 1)
     {
         DataGridCellInfo         cellInfo = grid.SelectedCells[0];
         SpreadsheetComponentCell cell     = cellInfo.Column.GetCellContent(cellInfo.Item) as SpreadsheetComponentCell;
         return(cell.data);
     }
     else
     {
         PointInt rangeStart = new PointInt(grid.Columns.Count, grid.Items.Count);
         PointInt rangeEnd   = new PointInt(-1, -1);
         foreach (DataGridCellInfo cellInfo in grid.SelectedCells)
         {
             PointInt position = GetCellPositionFromCellInfo(cellInfo);
             rangeStart.X = Math.Min(rangeStart.X, position.X);
             rangeStart.Y = Math.Min(rangeStart.Y, position.Y);
             rangeEnd.X   = Math.Max(rangeEnd.X, position.X);
             rangeEnd.Y   = Math.Max(rangeEnd.Y, position.Y);
         }
         string startId = data.cells[rangeStart.Y][rangeStart.X].id;
         string endId   = data.cells[rangeEnd.Y][rangeEnd.X].id;
         SpreadsheetRangeData rangeData = new SpreadsheetRangeData(this.valueStore, this.data, startId, endId);
         return(rangeData);
     }
 }
Exemple #6
0
 private void GetShapeVertices(PointInt minVert, PointInt maxVert, Curve shapeCurve, Point3d shapeCentre, Vector3d shapeTranslation)
 {
     for (int y = minVert.Y; y < maxVert.Y + 1; y++)
     {
         for (int z = minVert.Z; z < maxVert.Z; z++)
         {
             for (int x = minVert.X; x < maxVert.X; x++)
             {
                 Point3d currentVert = new Point3d(x * marchingArea.CellSize, y * marchingArea.CellSize, z * marchingArea.CellSize);
                 shapeCurve.ClosestPoint(currentVert, out double curveParam);
                 Point3d closestPoint  = shapeCurve.PointAt(curveParam);
                 double  distToCurrent = currentVert.DistanceTo(shapeCentre);
                 double  distToClosest = closestPoint.DistanceTo(shapeCentre);
                 double  dist          = currentVert.DistanceTo(closestPoint);
                 if (distToClosest > distToCurrent)
                 {
                     marchingArea.Vertices[x, y, z] = (marchingArea.Vertices[x, y, z] > 0) ? marchingArea.Vertices[x, y, z] : dist;
                 }
                 else
                 {
                     dist = -dist;
                     marchingArea.Vertices[x, y, z] = (marchingArea.Vertices[x, y, z] > 0) ? marchingArea.Vertices[x, y, z]
                         : (dist > marchingArea.Vertices[x, y, z]) ? dist : marchingArea.Vertices[x, y, z];
                 }
             }
         }
         shapeCurve.Translate(shapeTranslation);
         shapeCentre = Point3d.Add(shapeCentre, shapeTranslation);
     }
 }
Exemple #7
0
        /// <summary>
        /// 判断瓦片是否与矩形相交(旋转某个角度后的矩形)
        /// </summary>
        /// <param name="tileRect">当前瓦片所在矩形</param>
        /// <param name="areaRect">大矩形</param>
        /// <param name="angle"></param>
        /// <returns></returns>
        public static bool CheckTileCrossRect(RectInt tileRect, RectInt areaRect, float angle)
        {
            bool b = false;

            if (tileRect != null && areaRect != null)
            {
                var             centerPoint = new PointInt((int)areaRect.Center.X, (int)areaRect.Center.Y);
                var             tPoint1     = GetRotatedPoint(tileRect.LeftTop, centerPoint, angle);
                var             tPoint2     = GetRotatedPoint(tileRect.LeftTop.GetOffSet(tileRect.Width, 0), centerPoint, angle);
                var             tPoint3     = GetRotatedPoint(tileRect.LeftTop.GetOffSet(tileRect.Width, tileRect.Height), centerPoint, angle);
                var             tPoint4     = GetRotatedPoint(tileRect.LeftTop.GetOffSet(0, tileRect.Height), centerPoint, angle);
                List <PointInt> lstTP       = new List <PointInt>()
                {
                    tPoint1, tPoint2, tPoint3, tPoint4
                };



                foreach (var item in lstTP)
                {
                    if (areaRect.Contains(item))
                    {
                        b = true;
                        break;
                    }
                }
            }
            return(b);
        }
Exemple #8
0
        private MyMath.Point getCornerVertex(PointInt point, int dir)
        {
            MyMath.Point pointF = (MyMath.Point)point;

            MyMath.Point face = pointF + cornerPos[dir];
            return(face);
        }
 public static PointInt operator -(PointInt lhs, PointInt rhs)
 {
     PointInt newPoint = new PointInt();
     newPoint.x = lhs.x - rhs.x;
     newPoint.y = lhs.y - rhs.y;
     return newPoint;
 }
Exemple #10
0
        public static ulong[][] Solve(int rows, int cols, ulong[][] matrix, ulong R)
        {
            var result = new ulong[rows][];

            for (var r = 0; r < rows; r++)
            {
                result[r] = new ulong[cols];
            }

            for (var loopIndex = 0; loopIndex < Math.Min((rows + 1) / 2, (cols + 1) / 2); loopIndex++)
            {
                var loopRows = rows - 2 * loopIndex;
                var loopCols = cols - 2 * loopIndex;

                var loopLength = LoopLength(loopRows, loopCols, loopIndex);

                var point0 = new PointInt(loopIndex, loopIndex);
                var r      = (int)(R % (ulong)loopLength);

                for (var d = 0; d < loopLength; d++)
                {
                    var pointFrom = point0 + GetLoopCoordinates(loopRows, loopCols, d);
                    var a         = Get(matrix, pointFrom);
                    var pointTo   = point0 + GetLoopCoordinates(loopRows, loopCols, (r + d) % loopLength);
                    Set(result, pointTo, a);
                }
            }

            return(result);
        }
        /// <summary>
        /// Converts a pixel from pixel XY coordinates at a specified level of detail into latitude/longitude WGS-84 coordinates (in degrees).
        /// </summary>
        /// <param name="pixelXY">the point in pixels</param>
        /// <param name="level">Level of detail, from 1 (lowest detail) to 23 (highest detail).</param>
        /// <returns>the location, latitude/longitude WGS-84 coordinates</returns>
        public static PointLatLng PixelXYToLatLong(PointInt pixelXY, int level)
        {
            double lat, lng;

            PixelXYToLatLong(pixelXY.X, pixelXY.Y, level, out lat, out lng);
            return(new PointLatLng(lng, lat));
        }
        public static PointLatLng PixelXYToModelXY(PointInt pixelPosition)
        {
            double lng, lat;

            PixelXYToModelXY(pixelPosition.X, pixelPosition.Y, out lng, out lat);
            return(new PointLatLng(lng, lat));
        }
Exemple #13
0
 public GeneratingEntity(ref Map map, PointInt currentPosition)
 {
     _map                 = map;
     _currentPosition     = currentPosition;
     _debugID             = Guid.NewGuid().GetHashCode() % 1000;
     _directionToPrevious = new PointInt(0, 0);
 }
Exemple #14
0
        public static bool inBounds <T>(this T[,] map, PointInt p)
        {
            int x = p.x;
            int y = p.y;

            return(!(x < 0 || x >= map.GetLength(0) || y < 0 || y >= map.GetLength(1)));
        }
        /// <summary>
        /// Converts a QuadKey into tile XY coordinates.
        /// </summary>
        /// <param name="quadKey">QuadKey of the tile.</param>
        /// <param name="tileXY"></param>
        /// <param name="level">Output parameter receiving the level of detail.</param>
        public static void QuadKeyToTileXY(string quadKey, out PointInt tileXY, out int level)
        {
            int x, y;

            QuadKeyToTileXY(quadKey, out x, out y, out level);
            tileXY = new PointInt(x, y);
        }
Exemple #16
0
 /// <summary>
 /// Konstruktor
 /// </summary>
 /// <param name="p">Position des Rechteckes</param>
 /// <param name="s">Größe des Rechteckes</param>
 public RectInt(PointInt p, SizeInt s)
 {
   x = p.x;
   y = p.y;
   w = s.w;
   h = s.h;
 }
Exemple #17
0
 public bool IsEmpty(PointInt p)
 {
     if (!p.IsIn(this))
     {
         return(true);
     }
     return(Cells[p.X, p.Y] == BlockType.None);
 }
Exemple #18
0
        public BorderRule(int[,] regionMap, PointInt point, int direction)
        {
            touchingPoint1 = point;
            regionId1      = regionMap.getValue(point);

            touchingPoint2 = point.Neighbor(direction);
            regionId2      = regionMap.getValue(touchingPoint2);
        }
Exemple #19
0
 internal void AddRule(int[,] regionMap, PointInt point, int direction)
 {
     if (!regionMap.sameAsNeighbor(point, direction))
     {
         var newRule = new BorderRule(regionMap, point, direction);
         this.Add(newRule);
     }
 }
Exemple #20
0
        /// <summary>
        /// 屏幕坐标转经纬度
        /// </summary>
        /// <param name="p"></param>
        /// <returns></returns>
        public PointLatLng PointToLatLng(PointInt p)
        {
            PointLatLng pll  = null;
            var         pPix = MapCenterPix.GetOffSet(p.X - ScreenArea.Width / 2, p.Y - ScreenArea.Height / 2);

            pll = MercatorHelper.PixelToLatLng(pPix, Zoom);
            return(pll);
        }
 /// <summary>
 /// Add the vertices of the given triangle to our
 /// vertex lookup dictionary and emit a triangle.
 /// </summary>
 void StoreTriangle(MeshTriangle triangle)
 {
     for (int i = 0; i < 3; ++i)
     {
         XYZ      p = triangle.get_Vertex(i);
         PointInt q = new PointInt(p);
         _triangles.Add(_vertices.AddVertex(q));
     }
 }
 public ITile this[PointInt pos]
 {
     get {
         return tiles[pos.y * m_columns + pos.x];
     }
     set {
         tiles[pos.y * m_columns + pos.x] = value;
     }
 }
Exemple #23
0
        public void SpeedTest()
        {
            Func <PointInt, IEnumerable <PointInt> > getNeighbors = p => new[]
            {
                new PointInt(p.X - 1, p.Y + 0),                 // L
                new PointInt(p.X + 1, p.Y + 0),                 // R
                new PointInt(p.X + 0, p.Y - 1),                 // B
                new PointInt(p.X + 0, p.Y + 1),                 // T
                new PointInt(p.X - 1, p.Y + 1),                 // TL
                new PointInt(p.X + 1, p.Y + 1),                 // TR
                new PointInt(p.X - 1, p.Y - 1),                 // BL
                new PointInt(p.X + 1, p.Y - 1),                 // BR
            };

            Func <PointInt, PointInt, double> getScoreBetween = (p1, p2) =>
            {
                var dx = p1.X - p2.X;
                var dy = p1.Y - p2.Y;
                return(Math.Sqrt(dx * dx + dy * dy));
            };

            var rand = new Random(42);

            for (int j = 0; j < 3; j++)
            {
                var start       = new PointInt(rand.Next(1000), rand.Next(1000));
                var destination = new PointInt(rand.Next(1000), rand.Next(1000));
                for (int i = 0; i < 4; i++)
                {
                    RandomMeldablePriorityTree <AStarUtilities.EncapsulatedSearchNode <PointInt> > .ChildrenCount = i + 2;
                    _output.WriteLine("Starting run with {0} children.", i + 2);

                    Func <PointInt, double> getHeuristicScore = p =>
                    {
                        var dx = p.X - destination.X;
                        var dy = p.Y - destination.Y;
                        return(Math.Sqrt(dx * dx + dy * dy));
                    };

                    _output.WriteLine("Going from {0} to {1}", start, destination);

                    var    sw = Stopwatch.StartNew();
                    double distance; bool success;
                    var    results = AStarUtilities.FindMinimalPath(start, destination, getNeighbors, getScoreBetween, getHeuristicScore, out distance, out success);

                    _output.WriteLine("Done in {0}s.", sw.Elapsed.TotalSeconds);
                    _output.WriteLine("Expansions: {0}", AStarUtilities.LastExpansionCount);
                    _output.WriteLine("Result Count: {0}", results.Count);
                    _output.WriteLine("Distance: {0}", distance);

                    Assert.True(success);
                    Assert.Equal(start, results.First());
                    Assert.Equal(destination, results.Last());
                }
            }
            RandomMeldablePriorityTree <AStarUtilities.EncapsulatedSearchNode <PointInt> > .ChildrenCount = 4;
        }
Exemple #24
0
        public void VerifyBidirectional()
        {
            Func <PointInt, IEnumerable <PointInt> > getNeighbors = p => new[]
            {
                new PointInt(p.X - 1, p.Y + 0),                 // L
                new PointInt(p.X + 1, p.Y + 0),                 // R
                new PointInt(p.X + 0, p.Y - 1),                 // B
                new PointInt(p.X + 0, p.Y + 1),                 // T
            };

            Func <PointInt, PointInt, double> getScoreBetween = (p1, p2) =>
            {
                // Manhatten Distance
                return(Math.Abs(p1.X - p2.X) + Math.Abs(p1.Y - p2.Y));
            };

            var rand = new Random(42);

            var start       = new PointInt(0, 0);
            var destination = new PointInt(400, 400);

            Func <PointInt, bool, double> getHeuristicScore = (p, backward) =>
            {
                var dx = backward ? (p.X - start.X) : (p.X - destination.X);
                var dy = backward ? (p.Y - start.Y) : (p.Y - destination.Y);
                return(Math.Sqrt(dx * dx + dy * dy));
            };

            _output.WriteLine("Going from {0} to {1}", start, destination);

            var    sw = Stopwatch.StartNew();
            double distance, distanceControl; bool success;
            var    results = AStarUtilities.BidirectionalFindMinimalPath(start, destination, getNeighbors, getScoreBetween, getHeuristicScore, out distance, out success);

            _output.WriteLine("Done in {0}s.", sw.Elapsed.TotalSeconds);
            _output.WriteLine("Expansions: {0}", AStarUtilities.LastExpansionCount);
            _output.WriteLine("Result Count: {0}", results.Count);
            _output.WriteLine("Distance: {0}", distance);

            Assert.True(success);
            Assert.Equal(start, results.First());
            Assert.Equal(destination, results.Last());

            sw.Restart();
            var resultsControl = AStarUtilities.FindMinimalPath(start, destination, getNeighbors, getScoreBetween, p => getHeuristicScore(p, false), out distanceControl, out success);

            _output.WriteLine("Control Done in {0}s.", sw.Elapsed.TotalSeconds);
            _output.WriteLine("Expansions: {0}", AStarUtilities.LastExpansionCount);
            _output.WriteLine("Result Count: {0}", resultsControl.Count);
            _output.WriteLine("Distance: {0}", distanceControl);

            Assert.True(success);
            Assert.Equal(start, resultsControl.First());
            Assert.Equal(destination, resultsControl.Last());
            Assert.Equal(distanceControl, distance);
        }
Exemple #25
0
 public override void Draw(DrawingContext drawingContext, MapArea viewarea, double zoomRate)
 {
     foreach (ControlElement element in controlItems)
     {
         PointInt pos = BingMapTileSystem.LatLngToPixelXY(element.Location, viewarea.Level);
         Canvas.SetLeft(element, (pos.X - viewarea.Area.X) * zoomRate);
         Canvas.SetTop(element, (pos.Y - viewarea.Area.Y) * zoomRate);
     }
     base.Draw(drawingContext, viewarea, zoomRate);
 }
        public override void Draw(DrawingContext drawingContext, MapArea viewarea, double zoomRate)
        {
            PointInt p1   = BingMapTileSystem.LatLngToPixelXY(pos1, viewarea.Level);
            PointInt p2   = BingMapTileSystem.LatLngToPixelXY(pos2, viewarea.Level);
            RectInt  rect = RectInt.FromLTRB(p1.X, p1.Y, p2.X, p2.Y);

            drawingContext.DrawRectangle(Brushes.Blue, new Pen(),
                                         new System.Windows.Rect((rect.X - viewarea.Area.X) * zoomRate, (rect.Y - viewarea.Area.Y) * zoomRate, rect.Width * zoomRate, rect.Height * zoomRate));
            base.Draw(drawingContext, viewarea, zoomRate);
        }
        public void SetValueAt(double xPixel, double yPixel, double stretchedWidth, double stretchedHeight, bool value)
        {
            PointInt positionCube = renderManager.GetCubePosition(xPixel, yPixel, stretchedWidth, stretchedHeight);

            if (!(positionCube.X >= 0 && positionCube.X < width && positionCube.Y >= 0 && positionCube.Y < height))
            {
                return;
            }
            SetValueAt(positionCube.X, positionCube.Y, value);
        }
Exemple #28
0
        public static T getValue <T>(this T[,] map, PointInt p)
        {
            int x = p.x;
            int y = p.y;

            if (!map.inBounds(p))
            {
                return(default(T));
            }
            return(map[x, y]);
        }
Exemple #29
0
        public static int getValue(this int[,] map, PointInt p)
        {
            int x = p.x;
            int y = p.y;

            if (!map.inBounds(p))
            {
                return(-1);
            }
            return(map[x, y]);
        }
        public static PointInt[] Solve(int N, int[][] commands, long[] K)
        {
            var squares = new SquareInfo[commands.Length + 1];

            squares[0] = new SquareInfo {
                Row = 0, Col = 0, Width = N, First = 0, DeltaInRow = 1, DeltaInCol = N, Direction = 0
            };
            squares[0].CalcExtra(N);
            for (var i = 1; i <= commands.Length; i++)
            {
                var command = commands[i - 1];
                var ai      = command[0];
                var bi      = command[1];
                var di      = command[2];

                var prev = squares[i - 1];

                var newRow = ai - 1;
                var newCol = bi - 1;

                var square = new SquareInfo
                {
                    Row        = newRow,
                    Col        = newCol,
                    Width      = di + 1,
                    First      = prev.First + (newCol - prev.Col) * prev.DeltaInRow + (newRow - prev.Row + di) * prev.DeltaInCol,
                    DeltaInRow = -prev.DeltaInCol,
                    DeltaInCol = prev.DeltaInRow,
                    Direction  = i % 4,
                };
                square.CalcExtra(N);
                squares[i] = square;
            }

            var result = new PointInt[K.Length];

            for (var i = 0; i < K.Length; i++)
            {
                var wi = K[i];

                var si = BinarySearchHelper.BinarySearchRightBiased(squares, sq =>
                {
                    var rem = wi % N;
                    var div = wi / N;

                    var contains = sq.MinRem <= rem && rem <= sq.MaxRem && sq.MinDiv <= div && div <= sq.MaxDiv;

                    return(contains ? 0 : 1);
                });

                result[i] = GetPoint(squares[si], wi, N);
            }
            return(result);
        }
Exemple #31
0
        public static T GetOrSet <T>(this T[,] arr, PointInt point, Func <T> createFunc) where T : class
        {
            var item = arr[point.X, point.Y];

            if (item == null)
            {
                item = createFunc();
                arr[point.X, point.Y] = item;
            }
            return(item);
        }
Exemple #32
0
 int AddPoint(List <ColoredPoint> result, PointInt point, int color, int prevColor)
 {
     if (prevColor != 0)
     {
         result.AddRange(BrezenhamLine(result[result.Count - 1], point, prevColor));
     }
     else
     {
         result.Add(new ColoredPoint(point.X, point.Y, color));
     }
     return(color);
 }
    public virtual void init(TileGrid grid, PointInt pos)
    {
        m_grid = grid;
        m_position = pos;

        transform.localPosition = new Vector2(pos.x, pos.y);

        tileUp = grid[pos.x, pos.y + 1];
        tileDown = grid[pos.x, pos.y - 1];
        tileLeft = grid[pos.x - 1, pos.y];
        tileRight = grid[pos.x + 1, pos.y];
    }
Exemple #34
0
        //public uint[] GetCountsForLine(int linePtr)
        //{
        //	uint[] result = _fGenerator.GetXCounts(linePtr);
        //	return result;
        //}

        public void FillCountsForBlock(PointInt position, SubJobResult subJobResult)
        {
            uint[]   counts    = subJobResult.Counts;
            bool[]   doneFlags = subJobResult.DoneFlags;
            double[] zValues   = subJobResult.ZValues;

            _fGenerator.FillXCounts(position, ref counts, ref doneFlags, ref zValues);

            subJobResult.Counts    = counts;
            subJobResult.DoneFlags = doneFlags;
            subJobResult.ZValues   = zValues;
        }
Exemple #35
0
        public static Point GetTopLeft(int count, double itemHeight, PointInt location)
        {
            Contract.Requires<ArgumentOutOfRangeException>(count >= 1, "count");
            Contract.Requires<ArgumentOutOfRangeException>(itemHeight > 0 && itemHeight.IsValid(), "itemHeight");

            double itemWidth = itemHeight / HeightOverWidth;

            //determine the location of 0,0
            Point point = new Point(0, itemHeight * .5 * (count - 1));

            //determine the start point for the row
            point.X += (itemWidth * 3 / 4) * location.Row;
            point.Y += (itemHeight / 2) * location.Row;

            //calculate the offset for the column
            point.X += (itemWidth * 3 / 4) * location.Column;
            point.Y -= (itemHeight / 2) * location.Column;

            return point;
        }
Exemple #36
0
        public static Point GetTopLeft(int count, double itemHeight, PointInt location)
        {
            if (count < 1)
                throw new ArgumentOutOfRangeException("count");
            if (itemHeight <= 0)
                throw new ArgumentOutOfRangeException("itemHeight");

            double itemWidth = itemHeight/HeightOverWidth;

            //determine the location of 0,0
            Point point = new Point(0, itemHeight * .5 * (count - 1));

            //determine the start point for the row
            point.X += (itemWidth * 3 / 4) * location.Row;
            point.Y += (itemHeight / 2) * location.Row;

            //calculate the offset for the column
            point.X += (itemWidth * 3 / 4) * location.Column;
            point.Y -= (itemHeight / 2) * location.Column;

            return point;
        }
Exemple #37
0
 /// <summary>
 /// Emit a vertex to OBJ. The first vertex listed 
 /// in the file has index 1, and subsequent ones
 /// are numbered sequentially.
 /// </summary>
 static void EmitVertex(
   StreamWriter s,
   PointInt p)
 {
     s.WriteLine("v {0} {1} {2}", p.X, p.Y, p.Z);
 }
Exemple #38
0
 /// <summary>
 /// Add the vertices of the given triangle to our
 /// vertex lookup dictionary and emit a triangle.
 /// </summary>
 void StoreTriangle(MeshTriangle triangle)
 {
     for (int i = 0; i < 3; ++i)
     {
         XYZ p = triangle.get_Vertex(i);
         PointInt q = new PointInt(p);
         _triangles.Add(_vertices.AddVertex(q));
     }
 }