Exemplo n.º 1
0
        public IOrientableCurve Morph(SpaceMorph xmorph)
        {
            var curve = Curve.DuplicateCurve();

            xmorph.Morph(curve);
            return(Create(curve));
        }
Exemplo n.º 2
0
        public override IGH_GeometricGoo Morph(SpaceMorph xmorph)
        {
            var dup = this.m_value.Duplicate();

            xmorph.Morph(dup);
            return(new GH_PointCloud((PointCloud)dup));
        }
Exemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="xmorph"></param>
        /// <returns></returns>
        public override IGH_GeometricGoo Morph(SpaceMorph xmorph)
        {
            var copy = Value.Duplicate(); // TODO check if need to copy before transform?

            copy.SpaceMorph(xmorph);
            return(new GH_HeMesh3d(copy));
        }
Exemplo n.º 4
0
        public override IGH_GeometricGoo Morph(SpaceMorph xmorph)
        {
            var copy = Value.Duplicate();

            xmorph.Morph(copy.Geometry);
            return(new GH_DisplayGeometry(copy));
        }
Exemplo n.º 5
0
        public override IGH_GeometricGoo Morph(SpaceMorph xmorph)
        {
            Mesh m = Value.DuplicateMesh();

            xmorph.Morph(m);
            return(new ResultMesh(m, m_results));
        }
Exemplo n.º 6
0
        public override IGH_GeometricGoo Morph(SpaceMorph xmorph)
        {
            if (Value == null)
            {
                return(null);
            }
            if (Value.PolyCurve == null)
            {
                return(null);
            }

            GsaMember1d mem = new GsaMember1d
            {
                Member = Value.Member
            };

            List <Point3d> pts = Value.Topology;

            for (int i = 0; i < pts.Count; i++)
            {
                pts[i] = xmorph.MorphPoint(pts[i]);
            }
            mem.Topology = pts;

            if (Value.PolyCurve != null)
            {
                PolyCurve crv = Value.PolyCurve.DuplicatePolyCurve();
                xmorph.Morph(crv);
                mem.PolyCurve = crv;
            }

            return(new GsaMember1dGoo(mem));
        }
Exemplo n.º 7
0
        public IOrientableCurve Morph(SpaceMorph xmorph)
        {
            var surface = (Surface)Surface.Duplicate();

            xmorph.Morph(surface);
            return(Create(surface, Curve));
        }
Exemplo n.º 8
0
        public override IGH_GeometricGoo Morph(SpaceMorph xmorph)
        {
            Point3d start = xmorph.MorphPoint(Value.From);
            Point3d end   = xmorph.MorphPoint(Value.To);
            Line    ln    = new Line(start, end);

            return(new ResultLine(ln, m_result1, m_result2, m_colour1, m_colour2, m_size1, m_size2));
        }
Exemplo n.º 9
0
        public override IGH_GeometricGoo Morph(SpaceMorph xmorph)
        {
            var dup = this.DuplicateGeometry() as GS_StructuralArea;

            xmorph.Morph(dup.Value);

            return(dup);
        }
Exemplo n.º 10
0
        public override IGH_GeometricGoo Morph(SpaceMorph xmorph)
        {
            var dup = this.DuplicateGeometry() as GS_PointLoad;

            xmorph.Morph(dup.Value);

            return(dup);
        }
Exemplo n.º 11
0
        //no idea if they work
        public override Grasshopper.Kernel.Types.IGH_GeometricGoo Morph(SpaceMorph xmorph)
        {
            for (int i = 0; i < this.Value.Nodes.Count; i++)
            {
                this.Value.Nodes[i] = xmorph.MorphPoint(this.Value.Nodes[i]);
            }

            return(this);
        }
Exemplo n.º 12
0
        public override IGH_GeometricGoo Morph(SpaceMorph xmorph)
        {
            GH_Spring nc = this.DuplicateGeometry() as GH_Spring;

            if (nc.Value.IsACurve)
            {
                xmorph.Morph(nc.Value.CurveA);
            }
            else
            {
                xmorph.Morph(nc.Value.PointA);
            }
            return(nc);
        }
Exemplo n.º 13
0
 public override IGH_GeometricGoo Morph(SpaceMorph xmorph)
 {
     if (Value == null)
     {
         return(null);
     }
     if (Value.Halfedges.Count < 1)
     {
         return(null);
     }
     // TODO: cast to Rhino.Geometry.Mesh
     Rhino.Geometry.Mesh mesh;
     CastTo <Rhino.Geometry.Mesh>(out mesh);
     xmorph.Morph(mesh);
     return(new GH_Mesh(mesh));
 }
Exemplo n.º 14
0
        public override IGH_GeometricGoo Morph(SpaceMorph xmorph)
        {
            if (Value == null)
            {
                return(null);
            }
            if (Value.Plane == null)
            {
                return(null);
            }
            GsaGridPlaneSurface dup = Value.Duplicate();
            Plane pln = dup.Plane;

            xmorph.Morph(ref pln);
            GsaGridPlaneSurface gridplane = new GsaGridPlaneSurface(pln);

            return(new GsaGridPlaneSurfaceGoo(gridplane));
        }
        public override IGH_GeometricGoo Morph(SpaceMorph xmorph)
        {
            if (Value == null)
            {
                return(null);
            }
            if (Value.Point == null)
            {
                return(null);
            }

            Point3d pt = Value.Point;

            pt = xmorph.MorphPoint(pt);
            GsaNode node = new GsaNode(pt);

            return(new GsaNodeGoo(node));
        }
Exemplo n.º 16
0
        public override IGH_GeometricGoo Morph(SpaceMorph xmorph)
        {
            if (Value == null)
            {
                return(null);
            }
            var copy       = Value.Duplicate();
            var pointCloud = new Rhino.Geometry.PointCloud(copy.ToPoint3dArray());

            xmorph.Morph(pointCloud);
            for (int i = 0; i < Value.Nodes.Count; i++)
            {
                copy.Nodes[i].X = pointCloud[i].Location.X;
                copy.Nodes[i].Y = pointCloud[i].Location.Y;
                copy.Nodes[i].Z = pointCloud[i].Location.Z;
            }
            return(new MolecularGoo(copy));
        }
Exemplo n.º 17
0
        public override IGH_GeometricGoo Morph(SpaceMorph xmorph)
        {
            if (Value == null)
            {
                return(null);
            }
            if (Value.SolidMesh == null)
            {
                return(null);
            }

            GsaMember3d elem = Value.Duplicate();
            Mesh        xMs  = elem.SolidMesh;

            xmorph.Morph(xMs);
            elem.SolidMesh = xMs;

            return(new GsaMember3dGoo(elem));
        }
Exemplo n.º 18
0
    //this is for morphing - dont even know what it is, but I dont have to
    public GeomObject Morph(SpaceMorph morph)
    {
        GeomObject mObj = Duplicate();

        foreach (string key in mObj.MemberDict.Keys)
        {
            List <IGH_Goo> newData = new List <IGH_Goo>();
            for (int i = 0; i < mObj.MemberDict[key].Count; i++)
            {
                if (typeof(IGH_GeometricGoo).IsAssignableFrom(mObj.MemberDict[key][i].GetType()))
                {
                    IGH_GeometricGoo geom = (IGH_GeometricGoo)mObj.MemberDict[key][i];
                    mObj.MemberDict[key][i] = geom.Morph(morph);
                }
            }
        }

        return(mObj);
    }
Exemplo n.º 19
0
        public override IGH_GeometricGoo Morph(SpaceMorph xmorph)
        {
            if (Value == null)
            {
                return(null);
            }
            if (Value.Line == null)
            {
                return(null);
            }

            GsaElement1d elem = Value.Duplicate();
            LineCurve    xLn  = Value.Line;

            xmorph.Morph(xLn);
            elem.Line = xLn;

            return(new GsaElement1dGoo(elem));
        }
Exemplo n.º 20
0
        public override IGH_GeometricGoo Morph(SpaceMorph xmorph)
        {
            if (Value == null)
            {
                return(null);
            }
            if (Value.Point == null)
            {
                return(null);
            }

            GsaNode node = Value.Duplicate();

            Point3d pt = node.Point;

            pt = xmorph.MorphPoint(pt);

            node.Point = pt;

            return(new GsaNodeGoo(node));
        }
Exemplo n.º 21
0
        public override IGH_GeometricGoo Morph(SpaceMorph xmorph)
        {
            if (Value == null)
            {
                return(null);
            }
            if (Value.NgonMesh == null)
            {
                return(null);
            }

            GsaElement3d elem = Value.Duplicate();
            Mesh         xMs  = elem.NgonMesh;

            xmorph.Morph(xMs);
            elem.NgonMesh = xMs;
            elem.TopoInt  = Value.TopoInt;
            elem.Topology = Value.Topology;

            return(new GsaElement3dGoo(elem));
        }
Exemplo n.º 22
0
        /*******************************************/

        public IGH_GeometricGoo Morph(SpaceMorph xmorph)
        {
            if (m_RhinoGeometry == null)
            {
                return(null);
            }
            else if (m_RhinoGeometry is Point3d)
            {
                Point3d morphed = xmorph.MorphPoint((Rhino.Geometry.Point3d)m_RhinoGeometry);
                return(new GH_IBHoMGeometry {
                    Value = morphed.FromRhino()
                });
            }
            else
            {
                GeometryBase geometry = ((GeometryBase)m_RhinoGeometry).Duplicate();
                xmorph.Morph(geometry);
                return(new GH_IBHoMGeometry {
                    Value = geometry?.IFromRhino()
                });
            }
        }
Exemplo n.º 23
0
        /// <summary>
        ///
        /// </summary>
        /// <typeparam name="V"></typeparam>
        /// <typeparam name="E"></typeparam>
        /// <param name="graph"></param>
        /// <param name="xmorph"></param>
        /// <param name="parallel"></param>
        public static void SpaceMorph <V, E>(this HeStructure <V, E> graph, SpaceMorph xmorph, bool parallel = false)
            where V : HeVertex <V, E>, IPosition3d
            where E : Halfedge <V, E>
        {
            var verts = graph.Vertices;

            if (parallel)
            {
                Parallel.ForEach(Partitioner.Create(0, verts.Count), range => Body(range.Item1, range.Item2));
            }
            else
            {
                Body(0, verts.Count);
            }

            void Body(int from, int to)
            {
                for (int i = from; i < to; i++)
                {
                    var v = verts[i];
                    v.Position = xmorph.MorphPoint(v.Position);
                }
            }
        }
Exemplo n.º 24
0
        public override IGH_GeometricGoo Morph(SpaceMorph xmorph)
        {
            if (Value == null)
            {
                return(null);
            }
            if (Value.Mesh == null)
            {
                return(null);
            }

            GsaElement2d elem = new GsaElement2d
            {
                Elements = Value.Elements
            };
            Mesh xMs = Value.Mesh;

            xmorph.Morph(xMs);
            elem.Mesh     = xMs;
            elem.TopoInt  = Value.TopoInt;
            elem.Topology = Value.Topology;

            return(new GsaElement2dGoo(elem));
        }
Exemplo n.º 25
0
        /// <summary>
        ///
        /// </summary>
        /// <typeparam name="V"></typeparam>
        /// <typeparam name="E"></typeparam>
        /// <param name="graph"></param>
        /// <param name="xmorph"></param>
        /// <param name="parallel"></param>
        public static void SpaceMorph <V, E>(this IHeStructure <V, E> graph, SpaceMorph xmorph, bool parallel = false)
            where V : HeElement, IHeVertex <V, E>, IVertex3d
            where E : HeElement, IHalfedge <V, E>
        {
            var verts = graph.Vertices;

            Action <Tuple <int, int> > body = range =>
            {
                for (int i = range.Item1; i < range.Item2; i++)
                {
                    var v = verts[i];
                    v.Position = xmorph.Apply(v.Position);
                }
            };

            if (parallel)
            {
                Parallel.ForEach(Partitioner.Create(0, verts.Count), body);
            }
            else
            {
                body(Tuple.Create(0, verts.Count));
            }
        }
        public override IGH_GeometricGoo Morph(SpaceMorph xmorph)
        {
            if (Value == null)
            {
                return(null);
            }
            if (Value.Brep == null & Value.PolyCurve == null)
            {
                return(null);
            }

            GsaMember2d mem = new GsaMember2d
            {
                Member = Value.Member
            };

            List <Point3d> pts = Value.Topology;

            for (int i = 0; i < pts.Count; i++)
            {
                pts[i] = xmorph.MorphPoint(pts[i]);
            }
            mem.Topology = pts;

            if (Value.VoidTopology != null)
            {
                for (int i = 0; i < Value.VoidTopology.Count; i++)
                {
                    pts = Value.VoidTopology[i];
                    for (int j = 0; j < pts.Count; j++)
                    {
                        pts[j] = xmorph.MorphPoint(pts[j]);
                    }
                    mem.VoidTopology.Add(pts);
                }
                mem.VoidTopologyType = Value.VoidTopologyType;
            }

            if (Value.InclusionLines != null)
            {
                for (int i = 0; i < Value.InclusionLines.Count; i++)
                {
                    PolyCurve xLn = Value.InclusionLines[i];
                    xmorph.Morph(xLn);
                    mem.InclusionLines.Add(xLn);
                }
                for (int i = 0; i < Value.IncLinesTopology.Count; i++)
                {
                    pts = Value.IncLinesTopology[i];
                    for (int j = 0; j < pts.Count; j++)
                    {
                        pts[j] = xmorph.MorphPoint(pts[j]);
                    }
                    mem.IncLinesTopology.Add(pts);
                }
                mem.IncLinesTopologyType = Value.IncLinesTopologyType;
            }
            if (Value.InclusionPoints != null)
            {
                pts = Value.InclusionPoints;
                for (int i = 0; i < pts.Count; i++)
                {
                    pts[i] = xmorph.MorphPoint(pts[i]);
                }
                mem.InclusionPoints = pts;
            }


            if (Value.Brep != null)
            {
                Brep brep = Value.Brep.DuplicateBrep();
                xmorph.Morph(brep);
                mem.Brep = brep;
            }
            if (Value.PolyCurve != null)
            {
                PolyCurve crv = Value.PolyCurve.DuplicatePolyCurve();
                xmorph.Morph(crv);
                mem.PolyCurve = crv;
            }

            return(new GsaMember2dGoo(mem));
        }
Exemplo n.º 27
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="xmorph"></param>
 /// <param name="vector"></param>
 /// <returns></returns>
 public static Vec3d Apply(this SpaceMorph xmorph, Vec3d vector)
 {
     return(xmorph.MorphPoint(vector));
 }
Exemplo n.º 28
0
 /// <summary>
 /// morph the object or a deformable representation of the object
 /// </summary>
 /// <param name="xmorph">spatial deform</param>
 /// <returns>deformed geometry</returns>
 public override IGH_GeometricGoo Morph(SpaceMorph xmorph)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 29
0
 /// <summary>
 /// Morph the object or a deformable representation of the object.
 /// </summary>
 /// <param name="xmorph"> Spatial deform. </param>
 /// <returns> Deformed geometry. If the local geometry can be deformed accurately, then the returned
 /// instance equals this instance. Not all geometry types can be accurately deformed though, if
 /// this is the case, this function will return an instance of another IGH_GeometricGoo derived
 /// type which can be deformed.</returns>
 public override IGH_GeometricGoo Morph(SpaceMorph xmorph)
 {
     return(null);
 }
Exemplo n.º 30
0
 public override IGH_GeometricGoo Morph(SpaceMorph xmorph)
 {
     return(base.m_value.Item2.Morph(xmorph));
 }
Exemplo n.º 31
0
 internal static extern bool ON_SpaceMorph_MorphGeometry(IntPtr pConstGeometry, double tolerance, [MarshalAs(UnmanagedType.U1)]bool quickpreview, [MarshalAs(UnmanagedType.U1)]bool preserveStructure, SpaceMorph.MorphPointCallback callback);