Anim8or Community

Please login or register.

Login with username, password and session length
Advanced search  

News:

Ian Ross has just released a book on Anim8or. It's perect for a beginner and a good reference for experienced users. It contains detailed chapters on every aspect, with many examples. Get your own copy here: "Anim8or Tutorial Book"

Pages: 1 ... 10 11 [12] 13 14 ... 20

Author Topic: WEEHEEEE oh, oh wait its dead, I thought it was dancing (CRE8OR NOTICE)  (Read 246301 times)

Thanos

  • Full Member
  • ***
  • Posts: 104
  • -.-
    • View Profile
Re: WEEHEEEE oh, oh wait its dead, I thought it was dancing (CRE8OR NOTICE)
« Reply #165 on: February 13, 2013, 09:54:37 am »

Ok I found 1 bug so far, if the line is vertical, the tangent of angle is infinite,... so it's blown up. I should try to find an alternative way to describe the line.
Logged

cooldude234

  • Sr. Member
  • ****
  • Posts: 902
  • You know what I realized, I dont have an avatar :\
    • View Profile
Re: WEEHEEEE oh, oh wait its dead, I thought it was dancing (CRE8OR NOTICE)
« Reply #166 on: February 13, 2013, 10:04:20 pm »

Ok I found 1 bug so far, if the line is vertical, the tangent of angle is infinite,... so it's blown up. I should try to find an alternative way to describe the line.
??? :S  ???
Logged
¼

Thanos

  • Full Member
  • ***
  • Posts: 104
  • -.-
    • View Profile
Re: WEEHEEEE oh, oh wait its dead, I thought it was dancing (CRE8OR NOTICE)
« Reply #167 on: February 14, 2013, 03:14:53 pm »

EDIT: Uhh  :-[  :-X it seems it needs just a tad of debugging, I'm sorry cooldude234!!
I meant that my code needs debugging, not yours. :D Yours is probably ok. I have little time this days because of exams, but I'll find some soon to do more tests to find the other bug too.

Quote from: cooldude234
??? :S  ???
Um in other words there is a chance of division by zero in my code. :)
Logged

cooldude234

  • Sr. Member
  • ****
  • Posts: 902
  • You know what I realized, I dont have an avatar :\
    • View Profile
Re: WEEHEEEE oh, oh wait its dead, I thought it was dancing (CRE8OR NOTICE)
« Reply #168 on: February 14, 2013, 05:34:53 pm »

if there was a division by zero then the code would crash (the program would just stop running and close), and VC++'s debugger would recognize the crash code and tell me it was a division by zero.

And I know that you mean your code, but I have no clue what you said by...
Quote
Ok I found 1 bug so far, if the line is vertical, the tangent of angle is infinite,... so it's blown up. I should try to find an alternative way to describe the line.
something about the tan of the angle is infinite, which I don't even know how that's possible and I just don't understand it.
Logged
¼

Thanos

  • Full Member
  • ***
  • Posts: 104
  • -.-
    • View Profile
Re: WEEHEEEE oh, oh wait its dead, I thought it was dancing (CRE8OR NOTICE)
« Reply #169 on: February 15, 2013, 11:06:00 am »

if there was a division by zero then the code would crash (the program would just stop running and close), and VC++'s debugger would recognize the crash code and tell me it was a division by zero.
Yes, in integers it would crash. In floats however the float variable gets a special value, #inf. Processing this value usually gives #nan (not a number), which makes things stop working well in general. I'm not sure if we are testing the same input though.

Quote from: cooldude234
And I know that you mean your code, but I have no clue what you said by...
Quote
Ok I found 1 bug so far, if the line is vertical, the tangent of angle is infinite,... so it's blown up. I should try to find an alternative way to describe the line.
something about the tan of the angle is infinite, which I don't even know how that's possible and I just don't understand it.
An example in 2D: a 2D line is described by y=ax+b. a is equal to tan(t), where t is the angle of the line. A vertical line is x=c. How much is a here? There is no a here, but vertical means, t=90 deg -> a=tan90 = #inf... unless you use different system to describe the line, without a and b.
Same for 3D.
Logged

cooldude234

  • Sr. Member
  • ****
  • Posts: 902
  • You know what I realized, I dont have an avatar :\
    • View Profile
Re: WEEHEEEE oh, oh wait its dead, I thought it was dancing (CRE8OR NOTICE)
« Reply #170 on: February 15, 2013, 05:23:36 pm »

An example in 2D: a 2D line is described by y=ax+b. a is equal to tan(t), where t is the angle of the line. A vertical line is x=c. How much is a here? There is no a here, but vertical means, t=90 deg -> a=tan90 = #inf... unless you use different system to describe the line, without a and b.
Same for 3D.
0.0 .....Ummm yea I don't get it
Logged
¼

Thanos

  • Full Member
  • ***
  • Posts: 104
  • -.-
    • View Profile
Re: WEEHEEEE oh, oh wait its dead, I thought it was dancing (CRE8OR NOTICE)
« Reply #171 on: February 16, 2013, 09:35:22 am »

Ah never mind I just used an if-branch for the division by zero.
I found the second bug too!! And it was SUCH A DUMB BUG :-X

So, cooldude234, here is ray-triangle intersection, version 2, I think it works ok now - I'm sorry I was that slow! I had some exams to sit these days. I hope it serves you well! If you find another bug, just let me know.


EDIT 2, 23/2/2013: Nope, this didn't work too. See version 3 for an update.
« Last Edit: February 23, 2013, 10:24:30 am by Thanos »
Logged

cooldude234

  • Sr. Member
  • ****
  • Posts: 902
  • You know what I realized, I dont have an avatar :\
    • View Profile
Re: WEEHEEEE oh, oh wait its dead, I thought it was dancing (CRE8OR NOTICE)
« Reply #172 on: February 16, 2013, 05:17:34 pm »

IT WORKS, sort of.
Everything is flipped on the z and x axis (when I draw something on the right side of the 0,0,0 worlds origin, the collision happens on the left side).
Now this is just stupid, I flipped every number I can and it either breaks, or does the exact same thing. I flipped the vertices and the collision point and it does the exact same thing ??? what the heck?

Also I don't mean to pester but can you go through and explain in the dumbed down version what your method of checking to see if it lies inside the triangle do? (by the way I'm using a different method of checking collision with the plane).
Logged
¼

cooldude234

  • Sr. Member
  • ****
  • Posts: 902
  • You know what I realized, I dont have an avatar :\
    • View Profile
Re: WEEHEEEE oh, oh wait its dead, I thought it was dancing (CRE8OR NOTICE)
« Reply #173 on: February 16, 2013, 06:05:56 pm »

Alrighty I got it to work, and I found out it doesn't work.
In other words I fixed the flipped axis issue but the checking if the collision is inside the triangle only works on 90 degree angles, on any other angle it screws up.
So now I'm right back to where I was before with all this stuff (several other methods only worked on 90 degrees, actually they may have been the same method but with just different implementations of it).
So... any thoughts?
Logged
¼

Thanos

  • Full Member
  • ***
  • Posts: 104
  • -.-
    • View Profile
Re: WEEHEEEE oh, oh wait its dead, I thought it was dancing (CRE8OR NOTICE)
« Reply #174 on: February 17, 2013, 09:48:27 am »

Oh boy... you're right, there's still another bug. Please be patient, I'll track it down.

What coordinate system are you using? x=right, y=up, z=back (standard)? x=right, y=up, z=far (flipped - probably not)? or maybe x=right, y=far, z=up (the best imho but nobody uses it)?

What I'm using. We know that two vertices have the same direction if their inner product is positive, the opposite direction if it's negative, zero if they form a right angle. Ie. if they form a 45 deg angle, x1*x2+y1*y2+z1*z2>=0, whereas for 120 deg it's <0.
So, if we take the vectors starting at the midways and ending at the corners, a point has to be 'in front of them' to be inside the triangle.

See the pic for an example. The dot inside the triangle is in front of all the sides, so the inner product with the red vectors will be positive in all cases. Instead, the blue dot outside is in front of the left and the down sides, but the right side looks the other way, so the inner product with its red vector will be negative.

Of course all vectors have to be relative to the midway before calculation (the second bug I corrected).
Logged

cooldude234

  • Sr. Member
  • ****
  • Posts: 902
  • You know what I realized, I dont have an avatar :\
    • View Profile
Re: WEEHEEEE oh, oh wait its dead, I thought it was dancing (CRE8OR NOTICE)
« Reply #175 on: February 17, 2013, 05:49:24 pm »

Okay that makes a little more sense (I get the algorithm just not that math still :\ ).
I am using the standard xyz as the right, up, back (it makes the most sense to me).

EDIT: so why isn't it working on non 90 degree angles?
« Last Edit: February 17, 2013, 11:18:12 pm by cooldude234 »
Logged
¼

cooldude234

  • Sr. Member
  • ****
  • Posts: 902
  • You know what I realized, I dont have an avatar :\
    • View Profile
Re: WEEHEEEE oh, oh wait its dead, I thought it was dancing (CRE8OR NOTICE)
« Reply #176 on: February 20, 2013, 08:32:31 pm »

Progress report, I just want to let everyone know that there is still progress being made.
I got sound working after 8 hard crucial months of trying to work on it.
So I'll be working on the sound engine slowly now. I'll be making algorithms to assist in calculating sound in 3D space. I'm also going to try to work on effects like reverb (echo) and such.

Right now there is support for playing wavs, oggs, flacs and whatever the heck you can think of (except mp3's they're patented and you have to buy a license to use it for commercial use, which is a load of bull poop I think). Surround sound is supported but just not working fully (as I'm only playing sound on 2 channels right now, having issues with my specific sound api devices on my computer).
I'm using the libsndfile and portaudio libraries to make this possible (thanks to the people who made them, and made them free!), meaning I'm processing and calculating all the wave form data myself (meaning there's a huge control I have over the audio, if I want to add reverb I can etc.)

EDIT: still stuck on collision though :S
Logged
¼

Thanos

  • Full Member
  • ***
  • Posts: 104
  • -.-
    • View Profile
Re: WEEHEEEE oh, oh wait its dead, I thought it was dancing (CRE8OR NOTICE)
« Reply #177 on: February 21, 2013, 02:37:16 pm »

EDIT: still stuck on collision though :S

Don't worry, I'm not dead yet... I'm just a little bit stuck.
Logged

cooldude234

  • Sr. Member
  • ****
  • Posts: 902
  • You know what I realized, I dont have an avatar :\
    • View Profile
Re: WEEHEEEE oh, oh wait its dead, I thought it was dancing (CRE8OR NOTICE)
« Reply #178 on: February 21, 2013, 05:07:17 pm »

When it comes to collision everyones stuck...
               it's as if they hit a wall
                  GET IT? hit a wall, because it's COLLISION :P
Logged
¼

Thanos

  • Full Member
  • ***
  • Posts: 104
  • -.-
    • View Profile
Re: WEEHEEEE oh, oh wait its dead, I thought it was dancing (CRE8OR NOTICE)
« Reply #179 on: February 22, 2013, 01:25:18 pm »

LOL I see what you did there :P
Logged
Pages: 1 ... 10 11 [12] 13 14 ... 20