List <MaskPoint> PrefilterPoints(IEnumerable <IMSPoint> msPoints) { List <MaskPoint> maskPoints = new List <MaskPoint>(msPoints.Count()); foreach (var msPoint in msPoints) { maskPoints.Add(new MaskPoint() { msPoint = msPoint, ghostedBy = null }); } for (int i = 0; i < maskPoints.Count - 1; i++) { if (maskPoints[i].IsGhost() || maskPoints[i + 1].IsGhost()) { continue; } double distance = (maskPoints[i].msPoint.GetPoint() - maskPoints[i + 1].msPoint.GetPoint()).Length; if (i != 0) { double prevDistance = (maskPoints[i].msPoint.GetPoint() - maskPoints[i - 1].msPoint.GetPoint()).Length; distance = Math.Min(prevDistance, distance); } for (int j = i + 1; j < maskPoints.Count; j++) { if (j == i + 1 || maskPoints[j].IsGhost()) { continue; } if ((maskPoints[j].msPoint.GetPoint() - maskPoints[i].msPoint.GetPoint()).Length <= distance) { maskPoints[j] = new MaskPoint() { msPoint = maskPoints[j].msPoint, ghostedBy = maskPoints[i].msPoint }; } } } for (int i = maskPoints.Count - 1; i > 0; i--) { if (maskPoints[i - 1].IsGhost() && maskPoints[i].IsGhost()) { maskPoints.RemoveAt(i - 1); } } if (maskPoints.Last().IsGhost()) { maskPoints.RemoveAt(maskPoints.Count - 1); } return(maskPoints); }
public void OnPressed(bool pressed, bool isRight) { if (pressed && !isRight) { s_SelectMaskPoint = this; Tool.GetChildInDepth("MaskInnerInputField", GameObject.Find("MaskUI")).GetComponent <InputField>().text = innerCubeIndex.ToString(); Tool.GetChildInDepth("MaskInputField", GameObject.Find("MaskUI")).GetComponent <InputField>().text = innerCubeIndex.ToString(); } if (!pressed && isRight) { isMask = !isMask; SetMask(isMask); } }
public MaskPointData(MaskPoint maskPoint) { this.cubeIndex = maskPoint.cubeIndex; this.innerCubeIndex = maskPoint.innerCubeIndex; this.isMask = maskPoint.isMask; }