refactoring

This commit is contained in:
Lars Brubaker 2022-05-04 18:08:31 -07:00
parent e4cdc106d8
commit 614ae5348c
4 changed files with 13 additions and 7 deletions

View file

@ -185,10 +185,16 @@ namespace MatterHackers.Plugins.EditorTools
private Matrix4X4 GetRingTransform()
{
Vector3 newBottomCenter = ObjectSpace.GetCenterPosition(RootSelection, placement);
var rotation = Matrix4X4.CreateRotation(new Quaternion(RootSelection.Matrix));
var translation = Matrix4X4.CreateTranslation(newBottomCenter);
return rotation * translation;
var rootSelection = RootSelection;
if (rootSelection != null)
{
Vector3 newBottomCenter = ObjectSpace.GetCenterPosition(RootSelection, placement);
var rotation = Matrix4X4.CreateRotation(new Quaternion(RootSelection.Matrix));
var translation = Matrix4X4.CreateTranslation(newBottomCenter);
return rotation * translation;
}
return Matrix4X4.Identity;
}
public override void Draw(DrawGlContentEventArgs e)