// // TODO: code below needs to be cleaned up & simplified // static void DraggableRadius(IChiselHandles handles, ref float diameterX, ref float diameterZ, Vector3 center, Vector3 up, Vector3 xVector, Vector3 zVector, IChiselHandle[] radiusHandles, bool isEllipsoid) { if (isEllipsoid) { Debug.Assert(radiusHandles.Length == 4); diameterX = -diameterX; handles.DoSlider1DHandle(ref diameterX, center, xVector, radiusHandles[1]); // right if (handles.lastHandleHadFocus) { var radiusX = diameterX * 0.5f; var radiusZ = diameterZ * 0.5f; var vecX = (xVector.normalized * radiusX); var vecZ = (zVector.normalized * radiusZ); handles.RenderDistanceMeasurement(center, center + vecX, radiusX); handles.RenderDistanceMeasurement(center, center + vecZ, radiusZ); } diameterX = -diameterX; handles.DoSlider1DHandle(ref diameterX, center, xVector, radiusHandles[0]); // left if (handles.lastHandleHadFocus) { var radiusX = diameterX * 0.5f; var radiusZ = diameterZ * 0.5f; var vecX = (xVector.normalized * radiusX); var vecZ = (zVector.normalized * radiusZ); handles.RenderDistanceMeasurement(center, center + vecX, radiusX); handles.RenderDistanceMeasurement(center, center + vecZ, radiusZ); } diameterZ = -diameterZ; handles.DoSlider1DHandle(ref diameterZ, center, zVector, radiusHandles[3]); // back if (handles.lastHandleHadFocus) { var radiusX = diameterX * 0.5f; var radiusZ = diameterZ * 0.5f; var vecX = (xVector.normalized * radiusX); var vecZ = (zVector.normalized * radiusZ); handles.RenderDistanceMeasurement(center, center + vecX, radiusX); handles.RenderDistanceMeasurement(center, center + vecZ, radiusZ); } diameterZ = -diameterZ; handles.DoSlider1DHandle(ref diameterZ, center, zVector, radiusHandles[2]); // forward if (handles.lastHandleHadFocus) { var radiusX = diameterX * 0.5f; var radiusZ = diameterZ * 0.5f; var vecX = (xVector.normalized * radiusX); var vecZ = (zVector.normalized * radiusZ); handles.RenderDistanceMeasurement(center, center + vecX, radiusX); handles.RenderDistanceMeasurement(center, center + vecZ, radiusZ); } diameterX = Mathf.Abs(diameterX); diameterZ = Mathf.Abs(diameterZ); } else { Debug.Assert(radiusHandles.Length == 1); handles.DoDistanceHandle(ref diameterX, center, up, radiusHandles[0]); // left diameterX = Mathf.Abs(diameterX); var radiusX = diameterX * 0.5f; if (handles.lastHandleHadFocus) { if (handles.TryGetClosestPoint(radiusHandles, out var closestPoint, interpolate: false)) { var vec = (closestPoint - center); handles.RenderDistanceMeasurement(center, center + vec, radiusX); } } } }