Skip to content

Commit

Permalink
add rotate-around-point to frame
Browse files Browse the repository at this point in the history
  • Loading branch information
rms80 committed Dec 30, 2016
1 parent dcc7dd2 commit 76bac6f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions math/Frame3f.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,17 @@ public Frame3f Rotated(float fAngle, int nAxis)
return this.Rotated(new Quaternionf(GetAxis(nAxis), fAngle));
}

public void RotateAround(Vector3f point, Quaternionf q)
{
Vector3f dv = q * (origin - point);
rotation = q * rotation;
origin = point + dv;
}
public Frame3f RotatedAround(Vector3f point, Quaternionf q)
{
Vector3f dv = q * (this.origin - point);
return new Frame3f(point + dv, q * this.rotation);
}

public void AlignAxis(int nAxis, Vector3f vTo)
{
Expand Down

0 comments on commit 76bac6f

Please sign in to comment.