/// <summary> /// Tekla's method overload, using coordinate system object instead of 3 points. /// Returns an enumerator for an array list of lists of plane - solid intersection points from all intersecting faces. /// The first item of one list contains points of the outmost intersection polygon and then the inner polygons (if there are any). /// </summary> /// <param name="solid">Solid to be intersected with a plane.</param> /// <param name="coordinateSystem">Coordinate system defining a plane.</param> /// <returns>Enumerator of point lists.</returns> public static IEnumerator IntersectAllFaces(this Model.Solid solid, Geometry3d.CoordinateSystem coordinateSystem) { var point2 = new Geometry3d.Point(coordinateSystem.Origin); var point3 = new Geometry3d.Point(coordinateSystem.Origin); point2.Translate(coordinateSystem.AxisX); point3.Translate(coordinateSystem.AxisY); return(solid.IntersectAllFaces(coordinateSystem.Origin, point2, point3)); }
/// <summary> /// Tekla's method overload, using geometric plane object instead of 3 points. /// Returns an enumerator for an array list of lists of plane - solid intersection points from all intersecting faces. /// The first item of one list contains points of the outmost intersection polygon and then the inner polygons (if there are any). /// </summary> /// <param name="solid">Solid to be intersected with a plane.</param> /// <param name="plane">Geometric plane.</param> /// <returns>Enumerator of point lists.</returns> public static IEnumerator IntersectAllFaces(this Model.Solid solid, Geometry3d.GeometricPlane plane) { var normalVector = plane.GetNormal(); var randomVector = GetRandomVector(); while (normalVector.GetAngleBetween(randomVector) == 0 || normalVector.GetAngleBetween(randomVector) == Math.PI) { randomVector = GetRandomVector(); } var firstVectorOnPlane = normalVector.Cross(randomVector); var secondVectorOnPlane = normalVector.Cross(firstVectorOnPlane); var point2 = new Geometry3d.Point(plane.Origin); var point3 = new Geometry3d.Point(plane.Origin); point2.Translate(firstVectorOnPlane); point3.Translate(secondVectorOnPlane); return(solid.IntersectAllFaces(plane.Origin, point2, point3)); }