/// <summary> /// Returns a clone of this PointCloud. /// </summary> public PointCloud Clone() { PointCloud pcClone = new PointCloud(); foreach (Point p in this) { pcClone.Add(p.Clone()); } return(pcClone); }
/// <summary> /// Returns a PointCloud of all points on the PolyLine. /// </summary> public PointCloud ToPointCloud() { // Create a point cloud from the points and return it PointCloud pointCloud = new PointCloud(); foreach (Point point in this) { pointCloud.Add(point.Clone()); } return(pointCloud); }
/// <summary> /// Returns the model points as a PointCloud. /// </summary> /// <returns>PointCloud object containing all model points.</returns> public PointCloud ToPointCloud() { PointCloud pointCloud = new PointCloud(); foreach (DMTTriangleBlock block in _blocks) { foreach (Point vertex in block.TriangleVertices) { pointCloud.Add(vertex); } } return(pointCloud); }
/// <summary> /// Creates a point cloud of all points that make up the "Top" surface of the /// DMT Model (i.e. those points that can be seen from above). /// </summary> /// <returns>PointCloud object containing the points.</returns> public PointCloud PointCloudFromTop() { PointCloud pointCloud = ToPointCloud(); // Raise the point up above the highest Z value // Work out the highest Z point double zMax = pointCloud.BoundingBox.MaxZ.Value; // Give it a bit of clearance zMax += 1.0; // Give all points the same z value PointCloud raisedCloud = new PointCloud(); foreach (Point cloudPoint in pointCloud) { Point raisedPoint = cloudPoint.Clone(); raisedPoint.Z = zMax; raisedCloud.Add(cloudPoint); } // Now project them down onto the surface ZoneModel(); List <Point> projectedPoints = null; projectedPoints = ProjectPoints(raisedCloud); // Remove the points that were not in the original top surface PointCloud finalCloud = new PointCloud(); for (int index = 0; index <= projectedPoints.Count - 1; index++) { if (projectedPoints[index] == pointCloud[index]) { finalCloud.Add(pointCloud[index]); } } return(finalCloud); }