public bool Intersect(IPanelSection section) { var sectionBox = section.GetBound(); var toolBox = this.GetBound(); return(sectionBox.Intersects(toolBox)); }
private Task ApplyActionToFacesAsync <T>(IPanelSection section, T toolApplication) where T : g3.BoundedImplicitFunction3d, IIntersector { var tasks = new List <Task <bool> >(); foreach (var face in section.Faces) { tasks.Add(Task.Run(async() => { if (await Task.Run(() => toolApplication.Intersect(face))) { if (face is SectionElementViewModel sevm) { await sevm.ApplyActionAsync(toolApplication); } else { throw new NotImplementedException(); } } return(true); })); } return(Task.WhenAll(tasks)); }
internal static Task RemoveActionAsync(this IPanelSection section, int index) { Task[] tasks = { RemoveActionFromFacesAsync(section, index), RemoveActionFromVolumeAsync(section, index) }; return(Task.WhenAll(tasks)); }
private static Task RemoveActionFromVolumeAsync(this IPanelSection section, int index) { return(Task.Run(() => { if (section.Volume is SectionVolumeViewModel svvm) { svvm.RemoveAction(index); } else { throw new NotImplementedException(); } })); }
private static Task RemoveActionFromFacesAsync(this IPanelSection section, int index) { var tasks = new List <Task>(); foreach (var face in section.Faces) { tasks.Add(Task.Run(() => { face.RemoveAction(index); })); } return(Task.WhenAll(tasks)); }
private Task ApplyActionToVolumeAsync <T>(IPanelSection section, T toolApplication) where T : g3.BoundedImplicitFunction3d /*, IIntersector*/, IIndexed { return(Task.Run(async() => { if (section.Volume is SectionElementViewModel sevm) { await sevm.ApplyActionAsync(toolApplication); } else { throw new NotImplementedException(); } })); }
internal static void RemoveAction(this IPanelSection section, int index) { foreach (var face in section.Faces) { face.RemoveAction(index); } if (section.Volume is SectionVolumeViewModel svvm) { svvm.RemoveAction(index); } else { throw new NotImplementedException(); } }
private static void AddFaceUpDown(this IList <ISectionFace> list, IPanelSection section, SectionPosition position) { list.Add(CreateFace(section.CenterX, section.CenterY, section.GetCenterZFaceUp(), section.SizeX, section.SizeY, Orientation.ZPos)); list.Add(CreateFace(section.CenterX, section.CenterY, section.GetCenterZFaceDown(), section.SizeX, section.SizeY, Orientation.ZNeg)); }
private static double GetCenterXFaceRigth(this IPanelSection section) => section.CenterX + section.SizeX / 2.0;
private static void AddFaceLeft(this IList <ISectionFace> list, IPanelSection section, SectionPosition position) { list.Add(CreateFace(section.GetCenterXFaceLeft(), section.CenterY, section.CenterZ, section.SizeY, section.SizeZ, Orientation.XNeg)); }
private static double GetCenterXFaceLeft(this IPanelSection section) => section.CenterX - section.SizeX / 2.0;
internal static AxisAlignedBox3d GetBound(this IPanelSection section) => new AxisAlignedBox3d(new Vector3d(section.CenterX, section.CenterY, section.CenterZ), section.SizeX / 2.0, section.SizeY / 2.0, section.SizeZ / 2.0);
public static IList <ISectionFace> CreateFaces(this IPanelSection section, SectionPosition position, IRemovalParameters removalParameters) { var list = new List <ISectionFace>(); _removalParameters = removalParameters; switch (position) { case SectionPosition.Center: list.AddFaceUpDown(section, position); break; case SectionPosition.SideTop: list.AddFaceUpDown(section, position); list.AddFaceTop(section, position); break; case SectionPosition.SideRigth: list.AddFaceUpDown(section, position); list.AddFaceRight(section, position); break; case SectionPosition.SideBottom: list.AddFaceUpDown(section, position); list.AddFaceBottom(section, position); break; case SectionPosition.SideLeft: list.AddFaceUpDown(section, position); list.AddFaceLeft(section, position); break; case SectionPosition.CornerTopRight: list.AddFaceUpDown(section, position); list.AddFaceTop(section, position); list.AddFaceRight(section, position); break; case SectionPosition.CornerTopLeft: list.AddFaceUpDown(section, position); list.AddFaceTop(section, position); list.AddFaceLeft(section, position); break; case SectionPosition.CornerBottomLeft: list.AddFaceUpDown(section, position); list.AddFaceBottom(section, position); list.AddFaceLeft(section, position); break; case SectionPosition.CornerBottomRight: list.AddFaceUpDown(section, position); list.AddFaceRight(section, position); list.AddFaceBottom(section, position); break; default: throw new ArgumentException(); } _removalParameters = null; return(list); }
private static double GetCenterYFaceTop(this IPanelSection section) => section.CenterY + section.SizeY / 2.0;
private static double GetCenterYFaceBottom(this IPanelSection section) => section.CenterY - section.SizeY / 2.0;
private static void AddFaceBottom(this IList <ISectionFace> list, IPanelSection section, SectionPosition position) { list.Add(CreateFace(section.CenterX, section.GetCenterYFaceBottom(), section.CenterZ, section.SizeX, section.SizeZ, Orientation.YNeg)); }
private static double GetCenterZFaceDown(this IPanelSection section) => section.CenterZ - section.SizeZ / 2.0;