Migrate ApplyAtCenter to IObject3D extension method
- Rename to ApplyAtBoundCenter - Change to return void and apply to instance
This commit is contained in:
parent
68348dfc78
commit
3331748239
6 changed files with 34 additions and 26 deletions
|
|
@ -287,22 +287,5 @@ namespace MatterHackers.MatterControl
|
|||
return meshGroup.GetAxisAlignedBoundingBox(transform);
|
||||
}
|
||||
|
||||
public static Matrix4X4 ApplyAtCenter(IObject3D object3DToApplayTo, Matrix4X4 transformToApply)
|
||||
{
|
||||
return ApplyAtCenter(object3DToApplayTo.GetAxisAlignedBoundingBox(Matrix4X4.Identity), object3DToApplayTo.Matrix, transformToApply);
|
||||
}
|
||||
|
||||
public static Matrix4X4 ApplyAtCenter(AxisAlignedBoundingBox boundsToApplyTo, Matrix4X4 currentTransform, Matrix4X4 transformToApply)
|
||||
{
|
||||
return ApplyAtPosition(currentTransform, transformToApply, boundsToApplyTo.Center);
|
||||
}
|
||||
|
||||
public static Matrix4X4 ApplyAtPosition(Matrix4X4 currentTransform, Matrix4X4 transformToApply, Vector3 postionToApplyAt)
|
||||
{
|
||||
currentTransform *= Matrix4X4.CreateTranslation(-postionToApplyAt);
|
||||
currentTransform *= transformToApply;
|
||||
currentTransform *= Matrix4X4.CreateTranslation(postionToApplyAt);
|
||||
return currentTransform;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue