Forums > MaxMSP

Plane with distance function

May 6, 2013 | 2:28 pm

Hello,

I’m exploring jit.gen with the distance function of a plane.

http://www.iquilezles.org/www/articles/distfunctions/distfunctions.htm

The idea suggested for a plane is:

float sdPlane( vec3 p, vec4 n )
{
// n must be normalized
return dot(p,n.xyz) + n.w;
}

So in jit.gen I add two branches.
The first is the dot product of a vec3 normalized between -1 to 1. and three components from another vector.
the second branche is the w value (4th component) from the other vector.

I does not give a plane.
Any advice would be appreciated …

– Pasted Max Patch, click to expand. –

May 6, 2013 | 3:50 pm

The vec4 n value is a constant parameter. You have it set to snorm:

– Pasted Max Patch, click to expand. –

Viewing 2 posts - 1 through 2 (of 2 total)