Exemplo n.º 1
0
        public string GetCoords(CsgFace face, Color strokeColor, Color fillColor, double lineWidth = 1)
        {
            Vector2 p1     = (new Vector2(face.v1.Position.X, -face.v1.Position.Y) + offset) * scale;
            Vector2 p2     = (new Vector2(face.v2.Position.X, -face.v2.Position.Y) + offset) * scale;
            Vector2 p3     = (new Vector2(face.v3.Position.X, -face.v3.Position.Y) + offset) * scale;
            string  coords = $"{p1.X:0.0}, {p1.Y:0.0}";

            coords += $", {p2.X:0.0}, {p2.Y:0.0}";
            coords += $", {p3.X:0.0}, {p3.Y:0.0}";
            return($"<polygon points=\"{coords}\" style=\"fill: {fillColor.Html}; stroke: {strokeColor}; stroke - width:.1\" />");
        }
Exemplo n.º 2
0
        public static bool FaceAtHeight(CsgFace face, double height)
        {
            if (!AreEqual(face.v1.Position.Z, height))
            {
                return(false);
            }

            if (!AreEqual(face.v2.Position.Z, height))
            {
                return(false);
            }

            if (!AreEqual(face.v3.Position.Z, height))
            {
                return(false);
            }

            return(true);
        }
Exemplo n.º 3
0
        public void Classify2(CsgFace face)
        {
            if (FaceAtHeight(face, EvaluateHeight))
            {
                Color color = new Color();
                switch (face.Status)
                {
                case FaceStatus.Unknown:
                    color = Color.Cyan;
                    break;

                case FaceStatus.Inside:
                    color = Color.Green;
                    break;

                case FaceStatus.Outside:
                    color = Color.Red;
                    break;

                case FaceStatus.Same:
                    color = Color.Gray;
                    break;

                case FaceStatus.Opposite:
                    color = Color.Yellow;
                    break;

                case FaceStatus.Boundary:
                    color = Color.Indigo;
                    break;

                default:
                    throw new NotImplementedException();
                }

                // make it transparent
                color = new Color(color, 100);

                classifiedFaces2.AppendLine(GetCoords(face, Color.Black, color));
            }
        }
Exemplo n.º 4
0
        public void Split(CsgFace faceToSplit, CsgFace splitAtFace)
        {
            if (FaceAtHeight(faceToSplit, EvaluateHeight))
            {
                allSplitPolygonDebug.AppendLine(GetCoords(faceToSplit));

                if (currentIndex == 0)
                {
                    htmlContent.AppendLine("<!DOCTYPE html>");
                    htmlContent.AppendLine("<html>");
                    htmlContent.AppendLine("<body>");
                    htmlContent.AppendLine("<br>Full</br>");
                }

                currentIndex++;
                individualPolygonDebug.AppendLine($"<br>{currentIndex}</br>");
                individualPolygonDebug.AppendLine($"<svg height='{svgHeight}' width='{svgWidth}'>");
                individualPolygonDebug.AppendLine(GetCoords(faceToSplit));
                individualPolygonDebug.AppendLine(GetCoords(splitAtFace));
                individualPolygonDebug.AppendLine("</svg>");
            }
        }
Exemplo n.º 5
0
 public string GetCoords(CsgFace face)
 {
     return(GetCoords(face, Color.Black, new Color(Color.Red, 100)));
 }