Skip to content

Simplify box() face construction#1734

Open
xiaodoliu wants to merge 1 commit intoRayTracing:dev-patchfrom
xiaodoliu:simplify-box-helper
Open

Simplify box() face construction#1734
xiaodoliu wants to merge 1 commit intoRayTracing:dev-patchfrom
xiaodoliu:simplify-box-helper

Conversation

@xiaodoliu
Copy link

Resolves #1733

Copy link
Collaborator

@hollasch hollasch left a comment

Choose a reason for hiding this comment

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

Just realized that there's no need for the vector negations. My mental model was to "anchor" the cross product for the normal vector to the given point (min or max). But cross products aren't "from" any point at all, so we can just choose the simplest cross product that yields the face normal. Put even more simply: ${-\vec{A}} \times {-\vec{B}} = \vec{A} \times \vec{B}$.

@hollasch
Copy link
Collaborator

hollasch commented Mar 3, 2026

Note that I'm traveling and may not get back to this until March 12.

@xiaodoliu
Copy link
Author

Just realized that there's no need for the vector negations. My mental model was to "anchor" the cross product for the normal vector to the given point (min or max). But cross products aren't "from" any point at all, so we can just choose the simplest cross product that yields the face normal. Put even more simply: − A → × − B →= A → × B → .

Just realized that there's no need for the vector negations. My mental model was to "anchor" the cross product for the normal vector to the given point (min or max). But cross products aren't "from" any point at all, so we can just choose the simplest cross product that yields the face normal. Put even more simply: − A → × − B →= A → × B → .

Although the face normal is the same after flipping both vectors, it changes the vertex positions.

For example, quad(Q, −u, −v) gives vertices (Q, Q−u, Q−v, Q−u−v), while quad(Q, u, v) gives (Q, Q+u, Q+v, Q+u+v). The quad is no longer in the same position unless the anchor is offset to Q−u−v (i.e., quad(Q−u−v, u, v)).

So when constructing faces from the max point, we still need the vector negations.

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