public Point3d NextPoint() { Point3d pOut = this.currentPoint; Box reachBox = new Box(new Plane(currentPoint, Vector3d.ZAxis), new Interval((0 - this.StepSize), this.StepSize), new Interval((0 - this.StepSize), this.StepSize), new Interval((0 - this.StepSize), this.StepSize)); DoFPointsArray points = reachBox.GetFreePoints(); List <Point3d> pointCloud = points.GetPoints(_HV2D, _HV3D, _FaceHV2D, _FaceHV3D, _Diag); int index = this.Rand.Next(0, (pointCloud.Count - 1)); pOut = pointCloud[index]; pOut = pOut.BoundPoint(this.Bounds, true); this.currentPoint = pOut; return(pOut); }
public static DoFPointsArray GetFreePoints(this Box box) { double x0 = box.X.T1 + box.Center.X; double y0 = box.Y.T1 + box.Center.Y; double z0 = box.Y.T1 + box.Center.Z; double x1 = box.X.T0 + box.Center.X; double y1 = box.Y.T0 + box.Center.Y; double z1 = box.Z.T0 + box.Center.Z; DoFPointsArray outPoints = new DoFPointsArray(); outPoints.HV2D.Add(new Point3d(x0, 0, 0)); //1 outPoints.HV2D.Add(new Point3d(0, y0, 0)); //2 outPoints.HV2D.Add(new Point3d(x1, 0, 0)); //3 outPoints.HV2D.Add(new Point3d(0, y1, 0)); //4 outPoints.HV3D.Add(new Point3d(0, 0, z0)); //1 outPoints.HV3D.Add(new Point3d(0, 0, z1)); //2 outPoints.FaceHV2D.Add(new Point3d(x0, y1, 0)); //1 outPoints.FaceHV2D.Add(new Point3d(x1, y0, 0)); //2 outPoints.FaceHV2D.Add(new Point3d(x0, y0, 0)); //3 outPoints.FaceHV2D.Add(new Point3d(x1, y1, 0)); //4 outPoints.FaceHV3D.Add(new Point3d(x0, 0, z0)); //1 outPoints.FaceHV3D.Add(new Point3d(x0, 0, z1)); //2 outPoints.FaceHV3D.Add(new Point3d(0, y0, z0)); //3 outPoints.FaceHV3D.Add(new Point3d(0, y0, z1)); //4 outPoints.FaceHV3D.Add(new Point3d(x1, 0, z0)); //5 outPoints.FaceHV3D.Add(new Point3d(x1, 0, z1)); //6 outPoints.FaceHV3D.Add(new Point3d(0, y1, z0)); //7 outPoints.FaceHV3D.Add(new Point3d(0, y1, z1)); //8 outPoints.Diag.Add(new Point3d(x0, y0, z0)); //1 outPoints.Diag.Add(new Point3d(x1, y0, z0)); //2 outPoints.Diag.Add(new Point3d(x1, y1, z0)); //3 outPoints.Diag.Add(new Point3d(x0, y1, z0)); //4 outPoints.Diag.Add(new Point3d(x0, y0, z1)); //5 outPoints.Diag.Add(new Point3d(x1, y0, z1)); //6 outPoints.Diag.Add(new Point3d(x1, y1, z1)); //7 outPoints.Diag.Add(new Point3d(x0, y1, z1)); //8 return(outPoints); }