/// <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); }
/// <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); }
/// <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); }