Example #1
0
        public static void addHermiteNormals(AbstractHermiteGrid grid, float cellSize, LineManager3DLines lines)
        {
            grid.ForEachGridPoint(p =>
            {
                var sign = grid.GetSign(p);
                var dirs = new[] { new Point3(1, 0, 0), new Point3(0, 1, 0), new Point3(0, 0, 1) };


                foreach (var dir in dirs)
                {
                    if (sign == grid.GetSign(p + dir))
                    {
                        continue;
                    }

                    //lines.AddLine(vertPos, end, Color.Black.dx());

                    var edge = grid.GetEdgeId(p, p + dir);

                    var edgeStart = grid.GetEdgeOffsets(edge)[0] + p;
                    var edgeEnd   = grid.GetEdgeOffsets(edge)[1] + p;

                    var normal = grid.GetEdgeNormal(p, edge);
                    var pos    = grid.GetEdgeIntersectionCubeLocal(p, edge);

                    pos = (p + pos) * cellSize;
                    lines.AddLine(pos, pos + normal * 0.4f * cellSize, Color.Blue);
                    lines.AddLine(edgeStart.ToVector3() * cellSize, edgeEnd.ToVector3() * cellSize, Color.LightBlue);

                    lines.AddCenteredBox(pos, 0.02f, Color.Red);
                }
            });
        }
Example #2
0
        public static void addHermiteVertices(AbstractHermiteGrid grid, float cellSize, LineManager3DLines lines)
        {
            grid.ForEachGridPoint(p =>
            {
                var sign = grid.GetSign(p);
                if (GridHelper.OrthogonalDirections3D.All(dir => grid.GetSign(p + dir) == sign))
                {
                    return;
                }
                var vertPos = p.ToVector3() * cellSize;

                var color = sign ? Color.Green.dx() : Color.LightGray.dx();
                //if (!sign)
                lines.AddCenteredBox(vertPos, cellSize * 0.1f, color);
            });
        }