-
Notifications
You must be signed in to change notification settings - Fork 69
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
par_shapes__weld_points error #30
Comments
I was specifically getting the crash with this helicoidal generation local function mix(a,b,f)
return a*(1-f)+b*f
end
local cb = ffi.cast("par_shapes_fn",function(inp,out,user)
local u,v=inp[0],inp[1]*NM.vueltas*2*math.pi
out[0] = mix(NM.i_r,1,u)*math.cos(v)
out[2] = mix(NM.i_r,1,u)*math.sin(v)
out[1] = inp[1]
end)
local helicoidal= par_shapes.create.parametric(cb,math.floor(NM.slices*NM.vueltas), math.floor(NM.stacks*NM.vueltas),nil); with vueltas=6, stacks=6,slices=32,i i_r = 0.625 or higher |
@prideout In any case, some kind of assertion should be added to happen instead of getting a crash. |
Thanks for the asserts!! |
I know this is old, but i have also stumbled on this problem trying to generate par_shapes_create_subdivided_sphere(). I did some digging trying to figure out what the code is doing, and the whole loop you mention assumes that there is no remapping happening 'backwards'. This means that when the code creates weldmap entry:
It assumes that the weldmap[p] was not yet remapped.
This is a correct assumption coming from the fact the when you go through the vtx list the nindex<->p remapping should happen in the opposite direction earlier. But it is actually not the case. Correct me if i'm wrong, but you are collecting bins in a bounding box formed by +/-epsilon. But then when actually comparing distances you use distance squared. I think with 'low poly' meshes it will not manifest but with something denser ones it messes up the order. Or am i missing something? |
Hi,
I am investigating some SIGSEGV error in par_shapes.
Crash happens with
par_shapes.create.cylinder(626,100)
(perhaps slightly higher numbers depending on the compiler-architecture)I have find this is due to par_shapes__weld_points generating meshes in which triangles contain points not present in the welded mesh.
If in https://github.com/prideout/par/blob/master/par_shapes.h#L1726 we add
It will assert sometimes when
nremoved > 0
Still looking for the bug but seems related to #20
The text was updated successfully, but these errors were encountered: