Need a 3d shape class
-
I’m working on a project using VRML to show 3d shapes of all kinds. I now search a class (or tips of how to create one) to represent an arbitary shape. For e.g. se this pic: http://www.ceco.se/xsim/ape/BoxWithSubtractionBox.GIF One shape could for e.g. be a wall (a regular box). Later the wall could have a window. Perfect would be if I in some way could create one box and later subtract one or many smaller shapes (the windows and doors) whenever I want. For creating the VRML it then would be good to retrieve the outside areas of the shape (the connection of all corners). All tips are welcomed. _____________________________ ...and justice for all APe
-
I’m working on a project using VRML to show 3d shapes of all kinds. I now search a class (or tips of how to create one) to represent an arbitary shape. For e.g. se this pic: http://www.ceco.se/xsim/ape/BoxWithSubtractionBox.GIF One shape could for e.g. be a wall (a regular box). Later the wall could have a window. Perfect would be if I in some way could create one box and later subtract one or many smaller shapes (the windows and doors) whenever I want. For creating the VRML it then would be good to retrieve the outside areas of the shape (the connection of all corners). All tips are welcomed. _____________________________ ...and justice for all APe
Divide it in smaller shapes. They call it meshing I think. It's an intensive operation, but afterwards you can do virtually anything with it. (cutting, bending, translations ...) Try searching on meshing or something? Hope this helps a little. "If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
-
I’m working on a project using VRML to show 3d shapes of all kinds. I now search a class (or tips of how to create one) to represent an arbitary shape. For e.g. se this pic: http://www.ceco.se/xsim/ape/BoxWithSubtractionBox.GIF One shape could for e.g. be a wall (a regular box). Later the wall could have a window. Perfect would be if I in some way could create one box and later subtract one or many smaller shapes (the windows and doors) whenever I want. For creating the VRML it then would be good to retrieve the outside areas of the shape (the connection of all corners). All tips are welcomed. _____________________________ ...and justice for all APe
This is a task that might grow exponentially in complexity as new 3D shapes are added. If you haven't read up on 3D scenery data structure modeling, now is a good time to do so. I don't know if there such a class, but what you'll need the following: 1. Track all vertices. 2. Track all edges. 3. Track all faces. Also, 4. Define what characteristics a face can have (flat, convex, concave, etc.) 5. Define where the interior and exterior of a face is and what their characteristics are (solid, hollow, etc.) Hmmm... upon further reading of your question, I realize that you already most likely know this and that you're asking for something else. Oh, well... :doh: -- The Blog: Bits and Pieces
-
This is a task that might grow exponentially in complexity as new 3D shapes are added. If you haven't read up on 3D scenery data structure modeling, now is a good time to do so. I don't know if there such a class, but what you'll need the following: 1. Track all vertices. 2. Track all edges. 3. Track all faces. Also, 4. Define what characteristics a face can have (flat, convex, concave, etc.) 5. Define where the interior and exterior of a face is and what their characteristics are (solid, hollow, etc.) Hmmm... upon further reading of your question, I realize that you already most likely know this and that you're asking for something else. Oh, well... :doh: -- The Blog: Bits and Pieces
Johann Gerell wrote: upon further reading of your question, I realize that you already most likely know this and that you're asking for something else. No, all thoughts that makes my brain active :) are good. I sure think there is some kind of algorithm out there that make what I want. Of course the best thing is to find it out myself but don’t really know where to start. _____________________________ ...and justice for all APe
-
I’m working on a project using VRML to show 3d shapes of all kinds. I now search a class (or tips of how to create one) to represent an arbitary shape. For e.g. se this pic: http://www.ceco.se/xsim/ape/BoxWithSubtractionBox.GIF One shape could for e.g. be a wall (a regular box). Later the wall could have a window. Perfect would be if I in some way could create one box and later subtract one or many smaller shapes (the windows and doors) whenever I want. For creating the VRML it then would be good to retrieve the outside areas of the shape (the connection of all corners). All tips are welcomed. _____________________________ ...and justice for all APe
d00_ape wrote: Perfect would be if I in some way could create one box and later subtract one or many smaller shapes (the windows and doors) whenever I want. This is combining solid objects using boolean operators, also called Constructive Solid Geometry (CSG). http://www.flipcode.com/cgi-bin/msg.cgi?showThread=00008781&forum=3dtheory&id=-1[^] ...cmk Save the whales - collect the whole set
-
d00_ape wrote: Perfect would be if I in some way could create one box and later subtract one or many smaller shapes (the windows and doors) whenever I want. This is combining solid objects using boolean operators, also called Constructive Solid Geometry (CSG). http://www.flipcode.com/cgi-bin/msg.cgi?showThread=00008781&forum=3dtheory&id=-1[^] ...cmk Save the whales - collect the whole set
cmk wrote: Constructive Solid Geometry Thanks for that. To bad there is no article on CP. I've looked at the link. Do you have others :-O _____________________________ ...and justice for all APe
-
I’m working on a project using VRML to show 3d shapes of all kinds. I now search a class (or tips of how to create one) to represent an arbitary shape. For e.g. se this pic: http://www.ceco.se/xsim/ape/BoxWithSubtractionBox.GIF One shape could for e.g. be a wall (a regular box). Later the wall could have a window. Perfect would be if I in some way could create one box and later subtract one or many smaller shapes (the windows and doors) whenever I want. For creating the VRML it then would be good to retrieve the outside areas of the shape (the connection of all corners). All tips are welcomed. _____________________________ ...and justice for all APe
I think CSG that was mentioned in previous post is too complex for your task. What you need is indeed a simple mesh object and elements of it were mentioned above as well. Let's start with a simple class for 3D point (you can call it vector if you want) with all possible geometrical manipulations like add, sub, mul, dev with point, with scalar, dot and cross products. After that you have to create a class to represent a face. If you remember geometry you know that three points in space is enough to represent a plane, so your "face" class have to include those three poins. Plus I suggest to include Normal Vector (normalized cross product of two differences between our three points, like p=b-a, q=c-a, n=cross(p,q) N=n/length(n)) which will represend visible side of a face and some props like single/double faced, shading method etc. Normal vector is very important cuz it'll help you to eliminate invisible faces on rendering stage. Another thing that we have to include in our face class is info about edges. That's all. Now to represent a normal 4-point plane you need 2 faces, so to represent a cube you need 12 faces. All boolean operation are very simple to perform on such objects. You need to solve only one equation to find points in space where two faces intersect and create new faces there. Hope it'll help.