GLBasic forum

Main forum => GLBasic - en => Topic started by: matchy on 2012-Aug-17

Title: Model compounding
Post by: matchy on 2012-Aug-17
As I can do this in 3dsmax, I was wondering if there is any snippets or libs for mesh compounding/subtracting.  :-[ For example, a cube is half way in a sphere and then, from two meshes, one new mesh is created with the subtracted vertices inside each model, or one model adds vertices in replace of the "cookie" bite subtraction from the other model.

Title: Re: Model compounding
Post by: erico on 2012-Aug-17
There must be ´polygon boolean´ somewhere, it should do it.


edit: oops read it wrongly, I thought you were looking for how to do it on 3ds.
Title: Re: Model compounding
Post by: matchy on 2012-Aug-17
I've attempted polygon slicing and so I suppose it's much of the same thing. The algorithms I explored for that all deal with loops through the vertices and including and excluding where required, but it get's a bit tricky there in technique.
Title: Re: Model compounding
Post by: mentalthink on 2012-Aug-17
I´m not sure how do this marchy, bt at least for me I think it´s a bit comples, perhaps it´s comething like collision beetween arrays... but I prefer use a 3D suite, it´s more easy  =D

Perhaps you can take infor from blender... you can download all the code of the complete 3D suite, and looking into it...
I donwloaded sometime ago, but when I sat Visual Studio compile I have some errors, basically for my ignorance about programming  :-[ :-[
Title: Re: Model compounding
Post by: matchy on 2012-Aug-17
Initially I was just hoping for an existing library, most likely in c because theoretically I can do it but I feel why invent the wheel.  ;/

For example, SUBTRACT_OBJ(obj_cookie, obj_teeth) where obj_ is a poly vertex array.   :-[ Check for each obj_teeth poly edge line intersection with each obj_cookie poly edge line. Mark entry and exit for toggling adding/removing vertices to new object.

It's a bit complex just for 2d you see.  :zzz: 
Title: Re: Model compounding
Post by: mentalthink on 2012-Aug-20
hi Matchy perhaps this can help you
http://www.cgal.org/

I´m not very sure, but I read about Booleans and a lot of thing for geometry...

In this video it´s a bit explained...

Title: Re: Model compounding
Post by: bigsofty on 2012-Aug-20
Constructive Solid Geometry is quite a complex subject, it's not a trivial task to produce in code. What do you need it for?
Title: Re: Model compounding
Post by: erico on 2012-Aug-20
Great Video! :good:
Reminds me of sculptris where you can also add and remove mesh detail while sculping, really nice.
Title: Re: Model compounding
Post by: mentalthink on 2012-Aug-20
HI Erico the good thing it´s the attached library... I Suppose this it´s for use whit OpenGL, and can do, a 3D editor or 3D simlation software... seems a very complex library...
Title: Re: Model compounding
Post by: matchy on 2012-Aug-20
CGAL looks good MT so I'll check it out later!

Title: Re: Model compounding
Post by: mentalthink on 2012-Aug-21
Ok, Matchy, perhaps I try to understand a bit... I think it´s something very interesting. And for make a 3D modeller I thin can do it, in fact some modellers I read are made whit this library.