• Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

126 Neutral

About ga

  • Rank
    Advanced Member
  1. Thank you for the replies. Spoonbender: That's true, but I've now looked at the asm output of gcc and the code was not there when the commas where still there. The code is inside a function with only 1 pointer argument and no local variables, so it's quite safe to assume that the code overwrites the return address (and the program did indeed crash after i removed the commas).
  2. In the meantime I've found that I should just omit the commas between the assembly command strings.. argh;) ga
  3. Hi, I've been playing with inline assembly in C, using the gcc compiler v3.3.5 under gentoo linux. Unfortunately, gcc seems to ignore my assembly code. I wrote a function which should crash the program by writing junk into the stack, but code execution continues normally after calling it. Here's the code: <code> asm ( "movl $1221,(%esp)\n", "movl $1221,4(%esp\n)", "movl $1221,8(%esp)\n", "movl $1221,12(%esp)\n" "movl $1221,16(%esp)\n" "movl $1221,20(%esp)\n" "movl $1221,24(%esp)\n" "movl $1221,28(%esp)\n" "movl $1221,32(%esp)\n" "movl $1221,36(%esp)\n" "movl $1221,40(%esp)\n" "movl $1221,44(%esp)\n" ); </code> Thanks in advance, ga
  4. Name a planet.

    I wouldn't name it until I know more about it ... then perhaps Arrakis.
  5. EXE format

    Maybe you're looking at the DOS header of a windows executable. Every windows executeable has got a DOS-header first, then a small DOS program (which prints something like "This program cannot be run in DOS mode"" to the screen), then the windows header. Further information: http://www.ctyme.com/intr/rb-2939.htm
  6. It's possible to find an analytical formula for the area given the angle phi: A = (p/2)*(ln((sqrt(e+1)*(cos(phi)+1)-sqrt(e-1)*sin(phi))/(sqrt(e+1)*(cos(phi)+1)+sqrt(e-1)*sin(phi)))/((e+1)*(e-1))^(3/2) + e*sin(phi)/((e+1)*(e-1)*(e*cos(phi)+1))) where p = a*(1-e^2), e is the excentricity and a is the semimajor axis, but i don't know of a way to invert this formula to get phi=phi(A)
  7. This works only the other way, you can assign a derived-class pointer to a base class pointer. For the conversion of a base class pointer to the derived class pointer you have to do an explicit cast (and you should be sure that it's really a pointer to this derived class): variable_symbol *derivedclasspointer = (variable_symbol*)getsymbol();
  8. I guess you mean convex/concave by closed/open meshes, since your method only works for convex meshes. For concave meshes, you need to subdivide them somehow to get smaller convex units. One possibility are BSP trees, you'll find information on them in the articles section of gamedev.net.
  9. Bsp generation question

    If you put it into one of the sub-trees you're building a leaf-based bsp tree. Alternatively, you could save a list of polygons on the splitting plane for each node. A disadvantage of leaf-based trees is that you possibly have to split the polygons on the node's plane further (more polygons in total) which you don't need to do with the node-based tree. It depends on your application which method is more appropriate.
  10. Big Numbers

    Quote:Original post by Wutalife37 I could split it up into multiple mods, but I would still need to use numbers as large as 10^24. If the number to the right of the % are no larger than 10^9 you will only need numbers up to 10^18, multiply only two numbers at once and then do the mod operation again: (A*B*C*D) % E = ((((((A%E)*(B%E))%E)*(C%E))%E)*(D%E))%E If you're working with C on a 64-bit computer int will already be 64 bits so you don't need long long.
  11. tesselation.

    Sounds like you're duplicating the vertices for every triangle. Just storing a list of vertices and a list of triangles with indices to the vertices and only manipulating the vertices should fix that.
  12. Contradicting definitions of XOR

    I've never seen xor used with more than two arguments, so it may not be "officially" defined.
  13. extending the algorithm for fractional values in the minor direction: subdivide the pixel finely enough in the minor direction, in n sub-pixels (not in memory). the beginning and the end point must be rounded to the sub pixel boundaries. then you can do the bresenham computations by multiplying all numbers in the bresenham algorithm by n, so all numbers are integers again. extending this for fractional values also in the major direction: you only need to compute the intersections of the line with lines parallel to the the minor direction passing through the start and the end point and then use this values as start and end points like in the above paragraph. it's possible that these intersections are already in the pixel above (if x (horizontal, to the right) is the major direction and increments are negative (y vertically pointing down) like in the picture you posted with the left points being the start), i think you have to do special handling here (painting the original start pixel and moving the start pixel to the pixel above for the loop). (i just notice the green Bresenham line doesn't seem to be correct in your picture if you look at the pixels at the left end) painting every pixel: if you select the pixel not lying diagonally to current pixel in a Bresenham iteration, do nothing special. If you select the one lying diagonally, you have either to color the pixel to the right or above (or the according pixels in the other octants) the current pixel or none of the two if the line goes exactly through the point where the 4 pixels meet. to decide this, you have to do a kind of half-step to get to the pixel boundary: Add only ddy/2; then paint the pixel above if error is bigger than ddx, paint the pixel right if error is smaller, paint none of them if error is exactly ddx.
  14. Random Numbers

    An online version of this book is available at http://www.library.cornell.edu/nr/bookcpdf.html, but with a special licence.
  15. steam power

    Quote:Original post by Motorherp ... 100 times stronger than normal muscle of the same diameter!! Now imagine that on a scale 100 times larger than human muscles.....Oh Yeah :) Don't forget one thing about scaling muscles: If they're 100 times the size (in all directions), their volume is 1000000 times that of human muscles, but the cross-sectional area is only 10000 times that of human muscles. Since they can support the same stress, and stress is force per area, they could only produce 10000 times the force of the human-fitted muscles. So if the small muscles can just lift an object, and you scale that object 100 times in each direction, the big muscle won't be able to lift it because it's 1000000 times the weight! Actually, if the muscles are 100 times as strong and 100 times as large as human muscles, they are just strong enough to lift 100 times as large things (with the same density) as humans. That's also the reason for ants being able to lift things 50 times their own weight without any special nanotube muscles.
  • Advertisement