Advertisement

OpenGL

Started by September 17, 2000 02:26 AM
0 comments, last by Sh_Shokouhfar 24 years, 2 months ago
Can OpenGL do boolean operations between generated solids ? For example union, subtract or intersect (like AutoCAD). 2221
2221
It can if you make a class for each of your objects then defining operators for them.

    // cube.hclass Cube{public:  double edge1[3]; // vector of edge 1  // make 8 edges if you need a cube  // other functions};// define operatorsCube operator* (const Cube&, const double);// etc...//// cube.cpp// other functions...Cube operator* (const Cube &cube, const double scalar){  cube.edge1[x] *= scalar;  // etc  return cube;}    


There, that will mutltiply a cube by a scalar. If you want to multiply two Cubes, take two Cubes instead of a Cube and a scalar...

S.

This topic is closed to new replies.

Advertisement