示例#1
0
        internal static global::Topologic.Edge EdgeByLine(BH.oM.Geometry.Line bhomLine)
        {
            if (bhomLine.Infinite)
            {
                throw new ArgumentException("Infinite line is not supported.");
            }

            global::Topologic.Vertex startVertex = Create.VertexByPoint(bhomLine.Start);
            global::Topologic.Vertex endVertex   = Create.VertexByPoint(bhomLine.End);

            return(global::Topologic.Edge.ByStartVertexEndVertex(startVertex, endVertex));
        }
示例#2
0
        public static Rhino.Geometry.NurbsSurface ToRhino_NurbsSurface(this global::Topologic.NurbsSurface nurbsSurface)
        {
            int  uDegree    = nurbsSurface.UDegree;
            int  vDegree    = nurbsSurface.VDegree;
            bool isRational = nurbsSurface.IsURational && nurbsSurface.IsVRational;
            int  uCount     = nurbsSurface.NumOfUControlVertices;
            int  vCount     = nurbsSurface.NumOfVControlVertices;

            Rhino.Geometry.NurbsSurface ghNurbsSurface = Rhino.Geometry.NurbsSurface.Create(
                3,
                isRational,
                uDegree + 1,
                vDegree + 1,
                uCount,
                vCount
                );

            int i = 0;

            for (int u = 0; u < uCount; ++u)
            {
                for (int v = 0; v < vCount; ++v)
                {
                    global::Topologic.Vertex controlVertex = nurbsSurface.ControlVertex(u, v);
                    ghNurbsSurface.Points.SetPoint(u, v, ToRhino(controlVertex));
                    ++i;
                }
            }

            List <double> uKnots = nurbsSurface.UKnots;

            uKnots = uKnots.GetRange(1, uKnots.Count - 2);
            for (int u = 0; u < uKnots.Count; u++)
            {
                ghNurbsSurface.KnotsU[u] = uKnots[u];
            }

            List <double> vKnots = nurbsSurface.VKnots;

            vKnots = vKnots.GetRange(1, vKnots.Count - 2);
            for (int v = 0; v < vKnots.Count; v++)
            {
                ghNurbsSurface.KnotsV[v] = vKnots[v];
            }

            if (!ghNurbsSurface.IsValid)
            {
                throw new Exception("A valid surface cannot be created from this Face.");
            }

            return(ghNurbsSurface);
        }
示例#3
0
        internal static BH.oM.Geometry.Line Line(global::Topologic.Edge edge)
        {
            global::Topologic.Vertex startVertex = edge.StartVertex;
            Point bhomStartPoint = Convert.Point(startVertex);

            global::Topologic.Vertex endVertex = edge.EndVertex;
            Point bhomEndPoint = Convert.Point(endVertex);

            BH.oM.Geometry.Line line = new BH.oM.Geometry.Line {
                Start = bhomStartPoint, End = bhomEndPoint, Infinite = false
            };
            return(line);
        }
示例#4
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            // Declare a variable for the input String
            global::Topologic.Vertex   vertex         = null;
            global::Topologic.Topology parentTopology = null;

            // Use the DA object to retrieve the data inside the first input parameter.
            // If the retieval fails (for example if there is no data) we need to abort.
            if (!DA.GetData(0, ref vertex))
            {
                return;
            }
            if (!DA.GetData(1, ref parentTopology))
            {
                return;
            }

            // If the retrieved data is Nothing, we need to abort.
            // We're also going to abort on a zero-length String.
            if (vertex == null)
            {
                return;
            }
            if (parentTopology == null)
            {
                return;
            }
            //if (data.Length == 0) { return; }

            // Convert the String to a character array.
            //char[] chars = data.ToCharArray();

            IList <global::Topologic.Edge> adjacentEdges = global::Topologic.Utilities.VertexUtility.AdjacentEdges(vertex, parentTopology);

            // Use the DA object to assign a new String to the first output parameter.
            DA.SetDataList(0, adjacentEdges);
        }
示例#5
0
 public static List <global::Topologic.Wire> ShortestPaths(global::Topologic.Graph graph, global::Topologic.Vertex startVertex, global::Topologic.Vertex endVertex, String vertexKey, String edgeKey, Nullable <int> timeLimitinSeconds)
 {
     return(graph.ShortestPaths(startVertex, endVertex, vertexKey, edgeKey, timeLimitinSeconds));
 }
示例#6
0
 public static global::Topologic.Topology SelectSubtopology(global::Topologic.Topology topology, global::Topologic.Vertex selector, int typeFilter)
 {
     return(topology.SelectSubtopology(selector, typeFilter));
 }
示例#7
0
        internal static IGeometry BasicGeometry(global::Topologic.Topology topology)
        {
            if (topology == null)
            {
                return(null);
            }

            global::Topologic.Vertex vertex = topology as global::Topologic.Vertex;
            if (vertex != null)
            {
                return(Convert.BasicGeometry(vertex));
            }

            global::Topologic.Edge edge = topology as global::Topologic.Edge;
            if (edge != null)
            {
                return(Convert.BasicGeometry(edge));
            }

            global::Topologic.Wire wire = topology as global::Topologic.Wire;
            if (wire != null)
            {
                return(Convert.BasicGeometry(wire));
            }

            global::Topologic.Face face = topology as global::Topologic.Face;
            if (face != null)
            {
                return(Convert.BasicGeometry(face));
            }

            global::Topologic.Shell shell = topology as global::Topologic.Shell;
            if (shell != null)
            {
                return(Convert.BasicGeometry(shell));
            }

            global::Topologic.Cell cell = topology as global::Topologic.Cell;
            if (cell != null)
            {
                return(Convert.BasicGeometry(cell));
            }

            global::Topologic.CellComplex cellComplex = topology as global::Topologic.CellComplex;
            if (cellComplex != null)
            {
                return(Convert.BasicGeometry(cellComplex));
            }

            global::Topologic.Cluster cluster = topology as global::Topologic.Cluster;
            if (cluster != null)
            {
                return(Convert.BasicGeometry(cluster));
            }

            //global::Topologic.Aperture aperture = topology as global::Topologic.Aperture;
            //if (aperture != null)
            //{
            //    return Aperture.Convert.BasicGeometry(aperture);
            //}

            throw new NotImplementedException("Geometry for this shape is not supported yet");
        }
示例#8
0
 public static double ParameterAtVertex(global::Topologic.Edge edge, global::Topologic.Vertex vertex)
 {
     return(global::Topologic.Utilities.EdgeUtility.ParameterAtVertex(edge, vertex));
 }
示例#9
0
 public static bool IsInside(global::Topologic.Face face, global::Topologic.Vertex vertex, double tolerance = 0.0001)
 {
     return(global::Topologic.Utilities.FaceUtility.IsInside(face, vertex, tolerance));
 }
示例#10
0
 public static List <global::Topologic.Edge> Edges(global::Topologic.Vertex vertex)
 {
     return(vertex.Edges);
 }
示例#11
0
 public static List <global::Topologic.Edge> AdjacentEdges(global::Topologic.Vertex vertex, global::Topologic.Topology parentTopology)
 {
     return(global::Topologic.Utilities.VertexUtility.AdjacentEdges(vertex, parentTopology));
 }
示例#12
0
 internal static IGeometry BasicGeometry(global::Topologic.Vertex vertex)
 {
     return(Point(vertex));
 }
示例#13
0
 public static List <double> Coordinates(global::Topologic.Vertex vertex)
 {
     return(vertex.Coordinates);
 }
示例#14
0
 public static global::Topologic.Wire ShortestPath(global::Topologic.Graph graph, global::Topologic.Vertex startVertex, global::Topologic.Vertex endVertex, String vertexKey, String edgeKey)
 {
     return(graph.ShortestPath(startVertex, endVertex, vertexKey, edgeKey));
 }
示例#15
0
 public static global::Topologic.Topology Rotate(global::Topologic.Topology topology, global::Topologic.Vertex origin,
                                                 double xVector = 0.0, double yVector = 0.0, double zVector = 0.0,
                                                 double degree  = 0.0)
 {
     return(global::Topologic.Utilities.TopologyUtility.Rotate(topology, origin, xVector, yVector, zVector, degree));
 }
示例#16
0
 public static global::Topologic.Wire Path(global::Topologic.Graph graph, global::Topologic.Vertex startVertex, global::Topologic.Vertex endVertex)
 {
     return(graph.Path(startVertex, endVertex));
 }
示例#17
0
 public static List <global::Topologic.Wire> AllPaths(global::Topologic.Graph graph, global::Topologic.Vertex startVertex, global::Topologic.Vertex endVertex, Nullable <int> timeLimitinSeconds)
 {
     return(graph.AllPaths(startVertex, endVertex, timeLimitinSeconds));
 }
示例#18
0
 public static global::Topologic.Graph Connect(global::Topologic.Graph graph, global::Topologic.Vertex vertex1, global::Topologic.Vertex vertex2, double tolerance = 0.0001)
 {
     return(graph.Connect(vertex1, vertex2, tolerance));
 }
示例#19
0
 public static bool Contains(global::Topologic.Cell cell, global::Topologic.Vertex vertex, bool allowOnBoundary = false, double tolerance = 0.0001)
 {
     return(global::Topologic.Utilities.CellUtility.Contains(cell, vertex, allowOnBoundary, tolerance));
 }
示例#20
0
 public static global::Topologic.Edge EdgeByStartVertexEndVertex(global::Topologic.Vertex startVertex, global::Topologic.Vertex endVertex)
 {
     return(global::Topologic.Edge.ByStartVertexEndVertex(startVertex, endVertex));
 }
示例#21
0
 public static global::Topologic.Topology Scale(global::Topologic.Topology topology, global::Topologic.Vertex origin, double xFactor = 1.0, double yFactor = 1.0, double zFactor = 1.0)
 {
     return(global::Topologic.Utilities.TopologyUtility.Scale(topology, origin, xFactor, yFactor, zFactor));
 }
示例#22
0
 public static int TopologicalDistance(global::Topologic.Graph graph, global::Topologic.Vertex startVertex, global::Topologic.Vertex endVertex)
 {
     return(graph.TopologicalDistance(startVertex, endVertex));
 }
示例#23
0
 internal static Point Point(global::Topologic.Vertex vertex)
 {
     return(new Point {
         X = vertex.X, Y = vertex.Y, Z = vertex.Z
     });
 }
示例#24
0
 public static int VertexDegree(global::Topologic.Graph graph, global::Topologic.Vertex vertex)
 {
     return(graph.VertexDegree(vertex));
 }
示例#25
0
 public static double Z(global::Topologic.Vertex vertex)
 {
     return(vertex.Z);
 }
示例#26
0
 public static List <global::Topologic.Vertex> AdjacentVertices(global::Topologic.Graph graph, global::Topologic.Vertex vertex)
 {
     return(graph.AdjacentVertices(vertex));
 }
示例#27
0
 public static bool ContainsVertex(global::Topologic.Graph graph, global::Topologic.Vertex vertex, double tolerance = 0.0001)
 {
     return(graph.ContainsVertex(vertex, tolerance));
 }
示例#28
0
 public static List <double> ParametersAtVertex(global::Topologic.Face face, global::Topologic.Vertex vertex)
 {
     return(global::Topologic.Utilities.FaceUtility.ParametersAtVertex(face, vertex));
 }
示例#29
0
 public static double Distance(global::Topologic.Vertex vertex, global::Topologic.Topology otherTopology)
 {
     return(global::Topologic.Utilities.VertexUtility.Distance(vertex, otherTopology));
 }
示例#30
0
 public static global::Topologic.Edge EdgeByCircle(global::Topologic.Vertex centerPoint, double radius,
                                                   double xAxisX, double xAxisY, double xAxisZ,
                                                   double normalX, double normalY, double normalZ)
 {
     return(global::Topologic.Utilities.EdgeUtility.ByCircle(centerPoint, radius, xAxisX, xAxisY, xAxisZ, normalX, normalY, normalZ));
 }