Skip to content
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

Add unit test for Object3D and Camera #7114

Merged
merged 4 commits into from
Sep 7, 2015
Merged

Add unit test for Object3D and Camera #7114

merged 4 commits into from
Sep 7, 2015

Conversation

simonThiele
Copy link
Contributor

As discussed last evening here is the PR with some unit tests for Object3D.

…tWorldQuaternion. Also add a unittest for camera lookAt
@arose
Copy link
Contributor

arose commented Sep 6, 2015

see #7108


// get a reference object for comparing
var reference = obj.rotateOnAxis(new THREE.Vector3(1, 0, 0), 45).rotation;
obj.rotateX(45);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rotateX() calls rotateOnAxis(). You are not actually testing anything here.

This appears to be an issue throughout this PR.

Also, Euler rotations are not unique. I do not think it is wise to compare them. Perhaps comparing the quaternions is best. But even so, the negation of a unit quaternion represents the same rotation.

@WestLangley
Copy link
Collaborator

@simonThiele Thank you for working on the unit tests. It is important!

@mrdoob
Copy link
Owner

mrdoob commented Sep 7, 2015

Do you mind going a "Indent spaces to tabs" in these files? We try to use tabs for indenting.

@simonThiele
Copy link
Contributor Author

yep, using tabs now.

var obj = new THREE.Object3D();

obj.lookAt(new THREE.Vector3(0, -1, 1));
ok( obj.getWorldRotation().x * RadToDeg === 45 , "x is equal" );
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getWorldRotation() or getWorldQuaternion()?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getWorldQuaternion! thx

mrdoob added a commit that referenced this pull request Sep 7, 2015
@mrdoob mrdoob merged commit e2c1c5f into mrdoob:dev Sep 7, 2015
@mrdoob
Copy link
Owner

mrdoob commented Sep 7, 2015

Sweet! Thanks!

@simonThiele simonThiele deleted the unittestsForObject3DAndCamera branch November 16, 2015 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants