-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unused method arguments in Rot
. Can it be removed?
#60
Comments
In fact I'm sure this is a bug. Looking at the JBox2D Rot.java code: public void getXAxis(Vec2 xAxis) {
xAxis.set(c, s);
}
public void getYAxis(Vec2 yAxis) {
yAxis.set(-s, c);
} It looks like it should be: Vector2 getXAxis(Vector2 xAxis) {
xAxis.x = cos
xAxis.y = sin
}
Vector2 getYAxis(Vector2 yAxis) {
yAxis.x = -sin
yAxis.y = cos
} |
It should be an optional (and be used), it is used to minimize the amount of objects created. |
@spydon: So do you think that mean it's a bug? In renderCenter.setFrom(Transform.mulVec2(xf, circle.position));
final radius = circle.radius;
xf.q.getXAxis(renderAxis); (it's actually the only code in the library that calls I only ask because I am porting the |
That does look like a bug indeed. I'd implement it something like this so that the user at least have the possibility to re-use a vector object: Vector2 getXAxis({Vector2? out}) {
final result = out ?? Vector2.zero();
return result..setValue(cos, sin);
} |
Thank you for clearing this up. I'm going to use your suggested fix for the I'll leave this issue open though so the team can correct the bug. |
These two methods in
common/rot.dart
:Take a
Vector2
but as far as I can see they aren't used. It looks likedynamics/fixture.dart
calls this method and passes in aVector2
but I think it is defunct.I'm trying to port this library to another language and I just hope I'm not missing anything here.
The text was updated successfully, but these errors were encountered: