/// <summary> /// Get points that are inside a polyhedron. /// </summary> /// <param name="p">The polyhedron.</param> /// <returns>The indices of the points.</returns> public List <int> GetInnerPoints(ConvexPolyhedron p, bool smartUpdate, bool influenceRegion2, Vector3?seedPoint = null) { List <int> points = new List <int>(); if (seedPoint != null) { if (false) { for (int k = 0; k < lastActivePoints.Count; ++k) { if (p.IsPointInside(Points[lastActivePoints[k]].RightHandedPosition, influenceRegion2)) { points.Add(lastActivePoints[k]); } } } else { for (int k = 0; k < Points.Count; ++k) { if (p.IsPointInside(Points[k].RightHandedPosition, influenceRegion2)) { points.Add(k); } } } } else { Vector3 _seedPoint = (Vector3)seedPoint; Vector3Int seedKey = GetKey(new Vector3(_seedPoint.x, _seedPoint.z, _seedPoint.y)); for (int i = -2; i <= 2; ++i) { for (int j = -2; j <= 2; ++j) { for (int l = -2; l <= 2; ++l) { var voxelPoints = GetVoxelForEditing(seedKey + new Vector3Int(i, j, l)); for (int k = 0; k < voxelPoints.Count; ++k) { if (p.IsPointInside(Points[voxelPoints[k]].RightHandedPosition.normalized, influenceRegion2)) { points.Add(voxelPoints[k]); } } } } } } return(points); }
/// <summary> /// Get points that are inside a polyhedron. /// </summary> /// <param name="p">The polyhedron.</param> /// <returns>The indices of the points.</returns> public int[] GetInnerPoints(ConvexPolyhedron p, Vector3?seedPoint = null) { List <int> points = new List <int>(); if (seedPoint != null) { for (int k = 0; k < Points.Count; ++k) { if (p.IsPointInside(Points[k].RightHandedPosition)) { points.Add(k); } } } else { Vector3 _seedPoint = (Vector3)seedPoint; Vector3Int seedKey = GetKey(new Vector3(_seedPoint.x, _seedPoint.z, _seedPoint.y)); for (int i = -2; i <= 2; ++i) { for (int j = -2; j <= 2; ++j) { for (int l = -2; l <= 2; ++l) { var voxelPoints = GetVoxelForEditing(seedKey + new Vector3Int(i, j, l)); for (int k = 0; k < voxelPoints.Count; ++k) { if (p.IsPointInside(Points[voxelPoints[k]].RightHandedPosition)) { points.Add(voxelPoints[k]); } } } } } } return(points.ToArray()); }
private List <int> GetInnerPoints(ConvexPolyhedron p, List <int> innerPoints) { List <int> points = new List <int>(); for (int k = 0; k < innerPoints.Count; ++k) { if (p.IsPointInside(PointCloud[innerPoints[k]].Position, influenceRegion2)) { points.Add(innerPoints[k]); } } return(points); }