internal void AddSupportCone(SupportCone supportCone, MagsAISurfaceIntersectionData magsAIIntersectionData) { foreach (var triangleIntersection in this.Keys) { if (triangleIntersection.ArrayIndex == supportCone.ModelIntersectedTriangle.ArrayIndex && triangleIntersection.TriangleIndex == supportCone.ModelIntersectedTriangle.TriangleIndex) { this.SupportCones.Add(magsAIIntersectionData, supportCone); break; } } }
internal static void FilterOnAngledPointAndWallThickness(MagsAISurfaceIntersectionData modelAngledSupportPoint, STLModel3D stlModel) { if (modelAngledSupportPoint.ModelIntersection != null && modelAngledSupportPoint.Filter == typeOfAutoSupportFilter.None) { if (!modelAngledSupportPoint.IsGroundSupport) { if (modelAngledSupportPoint.LastSupportedCenterAngle < 135 && modelAngledSupportPoint.LastSupportedCenterAngle > 90) { //calc horizontal normal in inverted direction var wallThicknessNormal = modelAngledSupportPoint.ModelIntersection.Normal; //convert to horizontal normal wallThicknessNormal.Z = 0; wallThicknessNormal.Normalize(); TriangleIntersection[] triangleIntersections = null; IntersectionProvider.IntersectTriangle(modelAngledSupportPoint.ModelIntersection.IntersectionPoint, wallThicknessNormal, stlModel, IntersectionProvider.typeDirection.OneWay, false, new Vector3Class(), out triangleIntersections); if (triangleIntersections != null) { //find nearest intersection point var distance = float.MaxValue; foreach (var intersectionPoint in triangleIntersections) { if (intersectionPoint != null) { if (VectorHelper.IsSameDirection((intersectionPoint.IntersectionPoint - modelAngledSupportPoint.ModelIntersection.IntersectionPoint), -wallThicknessNormal)) { var intersectionDistance = (modelAngledSupportPoint.ModelIntersection.IntersectionPoint - intersectionPoint.IntersectionPoint).Length; if (intersectionDistance > 0f && intersectionDistance < distance) { distance = intersectionDistance; } } } } if (distance != float.MaxValue && distance > 3f) { modelAngledSupportPoint.Filter = typeOfAutoSupportFilter.FilteredByDuplicatePoint; } } else { } } } } }