-
Notifications
You must be signed in to change notification settings - Fork 10
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
HW6 #8
base: main
Are you sure you want to change the base?
HW6 #8
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bit more time for debugging and it would be a very good submission
} | ||
|
||
float getAngle() const { | ||
return m_focus; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here you need to calculate angle back from the focus
earth.transform(transform.get()); | ||
// Tilt the Earth and rotate the Moon here | ||
CTransform earthT, moonT; | ||
earthT.rotate(Vec3f(0, 1, 0), 23.5f); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should be
earthT.rotate(Vec3f(0, 0, 1), -23.5f);
// 3. Set new pivot. | ||
// 2. Apply the transformation on the earth. | ||
Mat eT = CTransform().rotate(Vec3f(0, 1, 0), 2.0f).get(); | ||
earth.setPivot(earthPivot); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
earthPivot is not updated within the loop. It is initialized outside the loop and inside remains constant. Thus we can see that the Moon flies through the Earth on video
// 1. Derive Matrix for moon trans. | ||
// 3. Set new pivot. | ||
// 2. Apply the transformation on the earth. | ||
Mat sT = CTransform().rotate(Vec3f(0, 1, 0), 0.00547945205f).get(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rotation axis must have angle of 23,5 degrees
Mat sT = CTransform().rotate(Vec3f(0, 1, 0), 0.00547945205f).get(); | ||
earth.setPivot(sunPivot); | ||
earth.transform(sT); | ||
earthPivot = CTransform::point(earthPivot, sT); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not needed, because pivot is transformed internally
// 2. Apply the transformation on the earth. | ||
Mat sT = CTransform().rotate(Vec3f(0, 1, 0), 0.00547945205f).get(); | ||
earth.setPivot(sunPivot); | ||
earth.transform(sT); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is simply
earth.transform(transform.translate(earthPivot).rotate(Vec3f(0, 1, 0), alpha).translate(-earthPivot).get());
auto nAngle = aKeyframe1 + (aKeyframe2 - aKeyframe1)*step; | ||
cam3->setAngle(static_cast<float>(nAngle)); | ||
} | ||
scene.add(cam3); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you add the camera to the scene all the time?
// frame n - 1: angle = 30 | ||
if (frame > 0 && frame < nFrames/2) | ||
{ | ||
auto step = frame/(nFrames/2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
step all the time is equal to zero. You need to use
auto step = static_cast<float>(frame)/(nFrames/2);
No description provided.