상속: Plankton.PlanktonMesh
예제 #1
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)
        {
            //------------------INPUT--------------------//
            PlanktonMesh pMesh = new PlanktonMesh();

            DA.GetData(0, ref pMesh);

            Plane pln = new Plane();

            DA.GetData(1, ref pln);



            //------------------CALCULATE--------------------//
            PMeshExt pMeshE = new PMeshExt(pMesh);

            if (!pMeshE.isMeshTriangulated())
            {
                this.AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "The mesh has to be triangulated");
            }

            Point3d[] verticesXYZ = pMeshE.convertVerticesToXYZ();

            Vector3d[] vertexAreas = pMeshE.calcVertexVoronoiAreas(pln);



            //------------------OUTPUT--------------------//
            DA.SetDataList(0, verticesXYZ);
            DA.SetDataList(1, vertexAreas);
        }
예제 #2
0
        //-----------------------------------------CREATE PMESH PROJECTED TO XY PLANE-------------------------------------------//
        public PMeshExt projectMeshToXY()
        {
            PMeshExt pMeshE = new PMeshExt(this);

            for (int i = 0; i < pMeshE.Vertices.Count; i++)
            {
                pMeshE.Vertices[i].Z = 0.0f;
            }

            return(pMeshE);
        }
예제 #3
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)
        {
            //------------------INPUT--------------------//
            PlanktonMesh pMesh = new PlanktonMesh();

            DA.GetData(0, ref pMesh);

            bool projXY = false;

            DA.GetData(1, ref projXY);



            //------------------CALCULATE--------------------//
            PMeshExt pMeshE = new PMeshExt(pMesh);

            if (!pMeshE.isMeshTriangulated())
            {
                this.AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "The mesh has to be triangulated");
            }

            //Extract vertices from initial 3d pMesh
            Point3d[] verticesXYZ = pMeshE.convertVerticesToXYZ();

            //If projected then create new pMesh
            if (projXY)
            {
                pMeshE = pMeshE.projectMeshToXY();
            }

            Vector3d[] vertexAreas = pMeshE.calcVertexVoronoiAreas(projXY);



            //------------------OUTPUT--------------------//
            DA.SetDataList(0, verticesXYZ);
            DA.SetDataList(1, vertexAreas);
        }
예제 #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)
        {
            //------------------INPUT--------------------//
            PlanktonMesh pMesh = new PlanktonMesh();
            DA.GetData(0, ref pMesh);

            bool projXY = false;
            DA.GetData(1, ref projXY);



            //------------------CALCULATE--------------------//
            PMeshExt pMeshE = new PMeshExt(pMesh);

            if (!pMeshE.isMeshTriangulated())
            {
                this.AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "The mesh has to be triangulated");
            }

            //Extract vertices from initial 3d pMesh
            Point3d[] verticesXYZ = pMeshE.convertVerticesToXYZ();

            //If projected then create new pMesh
            if (projXY)
            {
                pMeshE = pMeshE.projectMeshToXY();
            }

            Vector3d[] vertexAreas = pMeshE.calcVertexVoronoiAreas(projXY);



            //------------------OUTPUT--------------------//
            DA.SetDataList(0, verticesXYZ);
            DA.SetDataList(1, vertexAreas);
        }
예제 #5
0
        //-----------------------------------------CREATE PMESH PROJECTED TO XY PLANE-------------------------------------------//
        public PMeshExt projectMeshToXY()
        {
            PMeshExt pMeshE = new PMeshExt(this);

            for(int i=0; i< pMeshE.Vertices.Count; i++)
            {
                pMeshE.Vertices[i].Z = 0.0f;
            }

            return pMeshE;
        }