gfxnomad

Member
  • Content count

    102
  • Joined

  • Last visited

Community Reputation

193 Neutral

About gfxnomad

  • Rank
    Member
  1. Does java have BST

    The TreeMap class is implemented using a Red-Black tree. Typically, standard libraries are concerned more with providing standard container interfaces along with complexity bounds rather than with the particular data structure which underlies an implementation of that interface. This type of modularity makes a lot of sense. Nonetheless, the Java TreeMap along with most (all?) implementations of the C++ library map are implemented using Red-Black trees which are self-balancing variants of BSTs.
  2. I need an N-ary tree data structure for a project on which I'm currently working (written in Python). I've found numerous binary tree packages floating around out there, but wasn't able to find any packages for n-ary trees. I wouldn't be that difficult to roll my own, but I figured I'd check if anyone had suggestions before I reinvented the wheel. Thanks, Rob
  3. OpenGl 3.0 Frustration

    Wavesonics, Actually, OpenGL 3.0 is pretty much the antithesis of a superset of OpenGL 2.0. It's true that if one creates a compatibility profile, then all of the OpenGL 2.x functionality is pretty much supported. However, a strict OpenGL 3.0 context provides an incredibly stripped down API (I jokingly refer to OpenGL 3.0 as OpenDT (Open Data Transfer) b/c it basically just provides an efficient interface for transferring data from the host to the GPU). If the OP is interested in using a strict OpenGL 3.0 context, then most of the tutorials available online are riddled with deprecated functionality. --Rob
  4. If you don't know if the list of vertices that make up a triangle are given in a clockwise or counter clockwise ordering, then no, you cannot reliably compute the normal. This is because the cross product is antisymmetric; that is cross(v1, v2) = -cross(v2, v1). Thus, if your triangles are oriented inconsistently, the outward direction for some triangles will be the inward direction for others and vice-versa. A consistent orientation is a prerequisite for computing a consistent set of normals for the mesh. In a worst case scenario, you can always orient your mesh by hand using a tool like meshlab and then load it into your program with a consistent orientation.
  5. arbin, This is a well studied problem. To properly calculate the normals you must have a consistent facet winding (or know the winding of each facet -- which is equivalent) and know the proper orientation (outside vs. inside) of at least one facet. In this case you can then propagate that normal orientation to the rest of the surface. I don't know where you heard the rumor about the cross product, but it is untrue. If your faces are wound consistently, the cross product can consistently yield the proper normal direction. So, long story short, with an arbitrary mesh and no known orientation, this is an ill posed problem and cannot be solved. However, the case in real life is almost never this bad as almost all of the models with which you will have to deal should have a consistent winding, and you just have to know which one that is (right-handed vs. left-handed). If your error is just in rendering, another simple approach you might consider is just to use 2-sided lighting. Each vertex gets 2 normals, calculated with opposite windings. Then the lighting calculation is carried out for both sides of the surface and everything is lit "properly".
  6. std::vector size() fail

    You need to post more code for us to have a fighting chance at finding your bug. Your current code doesn't even show where Effects is declared and/or initialized.
  7. c++: new 2 dimentional array???

    If there's not a particular reason you're using char arrays, let met suggest the following: std::vector<std::string> names(7); names[0] = "Ann"; names[1] = "Mary"; ... This is much less error prone, and much more C++ like. Cheers, Rob
  8. Normal detail encoding

    Does anyone have any ideas on this. I'm really sort of stuck. In addition, I think that the equations for Fu Fv Fuu Fvv, and Fuv in the paper (in section 2.3) may also be incorrect; as Fu seems to have no actual dependence on u ! Cheers, Rob
  9. Normal detail encoding

    Dave, Sorry about that, the link should be fixed now. --Rob
  10. Normal detail encoding

    Whoops! I didn't mean to post this in the AI section. Could the moderator please move this thread to the appropriate section? Thanks!
  11. Hi all, I'm trying to implement section 2.3 of this paper. I'm doing it in the process of trying to implement another multiresolution mesh processing paper. The problem is essentially as follows. I have a mesh (M^{j-1}) that is a simplified (e.g. coarsened or decimated) version of a mesh M^{j}. Additionally, I'm given a set of points P = {p_{0}, ... , p_{k}} which correspond to vertex positions in the mesh M^{j} which have been removed in M^{j-1}. The goal is to encode the positions of the points in P such that each is expressed as a set of barycentric coordinates over some triangle in M^{j-1} and some height in the direction of the phong normal field over this triangle. In other words, I'm trying to find a triangle in M^{j-1} and a set of barycentric coordinates in this triangle such that a point from the original mesh resides strictly in the normal direction at this point. The paper claims this can be done using a few steps of Newton iteration, but the setup of the problem is not immediately clear to me from the paper (granted, I'm running on a bit less sleep than usual). Any help would be greatly appreciated! Cheers, Rob [Edited by - gfxnomad on December 6, 2009 1:36:53 PM]
  12. From the wikipedia page for which this figure is source material: # The depth of a node n is the length of the path from the root to the node. The set of all nodes at a given depth is sometimes called a level of the tree. The root node is at depth zero. # The height of a tree is the length of the path from the root to the deepest node in the tree. A (rooted) tree with only a node (the root) has a height of zero. So there is no such thing as "depth node". There is "node depth" or "depth of a node". Also, the "depth" of the tree is usually used interchangeably with the "height of the tree". In this case, the depth/height of the tree is 3. The depth of the root node is 0. Finally, the depth of node 6 is 2. Cheers, Rob
  13. GUI libraries?

    I'd like to second the suggestion for Qt. It's a fantastic GUI library; well designed and easy to use. It's open source, cross platform, and the documentation is very good ... which is incredibly important when working with a 3rd party library.
  14. Beyond_Repair, That's interesting. Actually, I wrote this tool for a project our lab was working on exactly because nVidia's texture atlas generator failed to handle 32-bit textures incorrectly. I'd be happy to see if I can figure out what's going on. Would you be willing to provide some or all of the data you're trying to package? If so, pm me and I'll give you an address where you can send the data. Cheers, Rob
  15. I wrote a simple but fairly robust python script to accomplish this. You can take a look at it here. The nice thing is that it's written in python, so you should be able to run it without much fuss. Also, the source is pretty readable and the format is really simple.