par icon indicating copy to clipboard operation
par copied to clipboard

connect inversion

Open sonoro1234 opened this issue 5 years ago • 0 comments

I am proposing a change in the par_shapes__connect function. The change is in https://github.com/prideout/par/blob/master/par_shapes.h#L1166 from

    memcpy(newpts, cylinder->points + (slices + 1) * 3,
        sizeof(float) * (slices + 1) * 3);

to memcpy(newpts, cylinder->points ,sizeof(float) * (slices + 1) * 3);

This are the results from lsystem before connect_lsystem1

and after connect_lsystem2

difference is difficult to see.

But with this code:

        local mesh = par_shapes.create.empty()
	local tube = par_shapes.create.cylinder(slices, 1);
	local cone = par_shapes.create.cone(slices,1)
	mesh:merge(tube)
	cone:translate(1,1,3)
	mesh:connect(cone,slices)
	mesh:merge(cone)

we have before: end to end connection connect_cone1

and after: end to begining connection connect_cone2

For me, the expected result would be the second. The proposed change is in PR #35

Perhaps another solution would be having an extra boolean argument to par_shapes__connect for choosing the way of connect (direct or inverse)

What is your opinion?

sonoro1234 avatar Oct 16 '19 09:10 sonoro1234