protected override void GroundHogSolveInstance(IGH_DataAccess DA) { var SURFACE = default(Surface); // Access and extract data from the input parameters individually if (!DA.GetData(0, ref SURFACE)) { return; } // Convert Surface to Mesh; TODO: expose mesh parameters; handle multiple outputs Mesh[] PREMESH = Mesh.CreateFromBrep(SURFACE.ToBrep(), MeshingParameters.Default); var MESH = PREMESH[0]; var subMeshes = TerrainCalculations.Explode(MESH); var subCentres = TerrainCalculations.GetCenters(MESH); var subDirections = TerrainCalculations.GetDirections(subMeshes, subCentres); var subAngles = GetAngles(MESH); // Calculate ratios from angles var subPercentiles = new List <double>(); foreach (var angle in subAngles) { var radians = Math.PI * angle / 180.0; subPercentiles.Add(Math.Tan(radians) * 100); } // Assign variables to output parameters DA.SetDataList(0, subMeshes); DA.SetDataList(1, subCentres); DA.SetDataList(2, subDirections); DA.SetDataList(3, subAngles); DA.SetDataList(4, subPercentiles); }
protected override void GroundHogSolveInstance(IGH_DataAccess DA) { var MESH = default(Mesh); // Access and extract data from the input parameters individually if (!DA.GetData(0, ref MESH)) { return; } var subMeshes = TerrainCalculations.Explode(MESH); var subCentres = TerrainCalculations.GetCenters(MESH); var subDirections = TerrainCalculations.GetDirections(subMeshes, subCentres); var subAngles = GetAngles(MESH); // Calculate ratios from angles var subPercentiles = new List <double>(); foreach (var angle in subAngles) { var radians = Math.PI * angle / 180.0; subPercentiles.Add(Math.Tan(radians) * 100); } // Assign variables to output parameters DA.SetDataList(0, subMeshes); DA.SetDataList(1, subCentres); DA.SetDataList(2, subDirections); DA.SetDataList(3, subAngles); DA.SetDataList(4, subPercentiles); }
protected override void GroundHogSolveInstance(IGH_DataAccess DA) { var MESH = default(Mesh); var ASPECT = default(Vector3d); // Access and extract data from the input parameters individually if (!DA.GetData(0, ref MESH)) { return; } if (!DA.GetData(1, ref ASPECT)) { return; } var subMeshes = TerrainCalculations.Explode(MESH); var subCentres = TerrainCalculations.GetCenters(MESH); var subDirections = TerrainCalculations.GetDirections(subMeshes, subCentres); // This is the only step different to Slope; i.e. measure angle difference between slope and given vector var subAspects = GetAspects(subDirections, ASPECT); // Assign variables to output parameters DA.SetDataList(0, subMeshes); DA.SetDataList(1, subCentres); DA.SetDataList(2, subAspects); }
protected override void GroundHogSolveInstance(IGH_DataAccess DA) { var SURFACE = default(Surface); var ASPECT = default(Vector3d); // Access and extract data from the input parameters individually if (!DA.GetData(0, ref SURFACE)) { return; } if (!DA.GetData(1, ref ASPECT)) { return; } // Convert Surface to Mesh; TODO: expose mesh parameters; handle multiple outputs Mesh[] PREMESH = Mesh.CreateFromBrep(SURFACE.ToBrep(), MeshingParameters.Default); var MESH = PREMESH[0]; var subMeshes = TerrainCalculations.Explode(MESH); var subCentres = TerrainCalculations.GetCenters(MESH); var subDirections = TerrainCalculations.GetDirections(subMeshes, subCentres); // This is the only step different to Slope; i.e. measure angle difference between slope and given vector var subAspects = GetAspects(subDirections, ASPECT); // Assign variables to output parameters DA.SetDataList(0, subMeshes); DA.SetDataList(1, subCentres); DA.SetDataList(2, subAspects); }