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

HW6 #8

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

HW6 #8

wants to merge 1 commit into from

Conversation

otmanesabir
Copy link

No description provided.

Copy link
Contributor

@ereator ereator left a 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;
Copy link
Contributor

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);
Copy link
Contributor

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);
Copy link
Contributor

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();
Copy link
Contributor

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);
Copy link
Contributor

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);
Copy link
Contributor

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);
Copy link
Contributor

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);
Copy link
Contributor

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);

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.

2 participants