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

getImplicit does not produce desired results with an anisotropically scaled object. #399

Open
RealET opened this issue Sep 3, 2021 · 1 comment
Assignees

Comments

@RealET
Copy link
Contributor

RealET commented Sep 3, 2021

It appears that scale is not working properly in the context of getImplicit. When calling getImplict (scale vec obj), it treats the scale as uniform, rather than being allowed to have different values along each axis.
It has the same effect as converting V3 x y z into V3 a a a where a = cbrt (x * y * z).

test code:

implicitTest scaleVector = getImplicit (scale scaleVector obj) (scaleVector * p)
   where
     obj = Implicit.rect3 (V3 0 0 0) (V3 100 100 20)
     p = V3 50 50 10

implicitTest (V3 1 1 1) returns -10, as expected.
but implicitTest (V3 1 1 2) returns -12.5992, where I would have expected it to be -20. This is equivalent to the expected result if the scaleVector was V3 (cbrt 2) (cbrt 2) (cbrt 2).

@lepsa
Copy link
Contributor

lepsa commented Nov 18, 2022

I think that this is coming from the normalize s * call in getImplicitShared ctx (Scale s symbObj). Without that function call and multiplication I'm getting -10 for both any non-zero scaling factors. This is because scale works by point-wise division, and scaleVector * p neatly counters this.

The normalize function isn't used anywhere else in the code base, so if we want to remove it I think we can cut it out entirely.

@julialongtin Removing this function breaks several golden tests, so we will want to look at what the differences between the output are. It may just be noise down in the floating point calculations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants