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 ... 9 10 [11] 12 13 ... 20

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

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 #150 on: February 01, 2013, 07:49:29 pm »

anyone?
Logged
¼

Claude

  • Sr. Member
  • ****
  • Posts: 285
    • View Profile
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 #152 on: February 01, 2013, 09:40:14 pm »

Been there done that.
That page didn't give me any good results and it never worked.
Logged
¼

Claude

  • Sr. Member
  • ****
  • Posts: 285
    • View Profile
Re: WEEHEEEE oh, oh wait its dead, I thought it was dancing (CRE8OR NOTICE)
« Reply #153 on: February 03, 2013, 11:09:22 am »

If you can't make this work,have you tried a math lib like glm.
http://glm.g-truc.net/
http://glm.g-truc.net/api-0.9.4/a00179.html
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 #154 on: February 04, 2013, 12:03:56 am »

I've looked at glm before and didn't know it had collision.
But now the second question I shall look into, is it a good license.

EDIT: IE I don't want to use a whole library for one feature, especially when I worked hard at optimizing my math functions
« Last Edit: February 04, 2013, 12:24:49 am by cooldude234 »
Logged
¼

Thanos

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

Sorry for the late reply. I can give some help if I find time.
Tell me what exactly you mean "That page didn't give me any good results and it never worked."? What is the point that stops working correctly?
Also, how is a triangle defined in your code - to allow me write some compatible code? Like, ((x1,y1,z1),(x2,y2,z2),(x3,y3,z3)) (ie. is there a 'point' class? or maybe a 'triangle' class too?) Or raw data, like, (x1,y1,z1,x2,y2,z2,x3,y3,z3)?

EDIT: Oh also, how is the ray line defined? Point-and-direction or two-points-on-line? (Is there a 'ray' class or 'line' class? Show me.)
« Last Edit: February 08, 2013, 09:54:32 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 #156 on: February 08, 2013, 09:50:53 pm »

Triangles and their vertices are always defined the same way (if being traditional geometry), just by 3 points with a position for each dimensions, which in this case is three (3D). No matter if the vertecies are in a class, namespace, or structure of some sort, you can always get the floating point values form these vertices.
However the ray is a little different because you can define it by a point and direction, or by two points. In my case its by two points.

Now I've searched many many sites, and went though about 40 (search)pages on google.
I've got line-plane intersections to work. But that's only good if the plane is an infinite plane, so I need to detect whether the point is inside the triangle or not.
Also the method I'm using is probably not the fastest (A LOT of conversion and abstract math, it could be simplified).
I'm trying to look through the glm source code for some answers.
Logged
¼

Thanos

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

Here you are.  ;)

I think the code I once sent you for line plane intersection might have a bug. I tried avoiding it this time, do a test if you want.

EDIT: Oh my, where are my manners?
Return values: x, y, z: collision point.
Return value is a boolean indicating whether the point belongs in the triangle or not.

EDIT 2, 16/2/2013: This version had a bug, so I removed the attachment. See version 3 for an update.
« Last Edit: February 23, 2013, 10:22:58 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 #158 on: February 11, 2013, 05:48:50 pm »

Yea in my code I have setup the functions for plane intersection to return true if intersected and I use pointers to cast the collision point to the variable I wan't to store it in.

But anyways thanks I'll try in my code when I have time tonight.
Though I must ask what is with the Boolean variable rti? It's defined just to define floating point values. Why not just define the floating point values?

EDIT: I lied, I spent an hour and a half playing lone survivor, but I'm working on the code now so it counts I guess :P
« Last Edit: February 12, 2013, 12:29:24 am 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 #159 on: February 12, 2013, 01:23:24 am »

I tried the code and it still doesn't work.
Everything is fine up until I try to get it to find if the point is inside the triangle.
its making me really mad >:(

EDIT:some debugging led me to find out that (x-a)*a+(y-b)*b+(z-c)*c >= 0 is outputting values like -33 and -40 when the others are outputting stuff like 0.456 and -0.2357
« Last Edit: February 12, 2013, 01:35:02 am by cooldude234 »
Logged
¼

Thanos

  • Full Member
  • ***
  • Posts: 104
  • -.-
    • View Profile
Re: WEEHEEEE oh, oh wait its dead, I thought it was dancing (CRE8OR NOTICE)
« Reply #160 on: February 12, 2013, 07:55:33 am »

Quote from: cooldude234
Though I must ask what is with the Boolean variable rti? It's defined just to define floating point values. Why not just define the floating point values?

DUH!! It's not a variable! rti() is the complete function ready - made. You don't have to edit it! :P
rti() returns if the point is inside the triangle. I've already made it! see below for an example.

Example of use.
suppose we have, a triangle with points (1,2,3), (2,3,4), (3,4,5).
and a ray line from points (3,2,1), (2,0,1).

Rename rti.cpp to rti.h (should have done this myself - sorry)

And in your main program:
#include "rti.h"
...
float xi, yi, zi;
...
inTri = rti(1,2,3,2,3,4,3,4,5,3,2,1,2,0,1,&xi,&yi,&zi);
if (inTri == true)
{
    // The point is in the triangle.
    // The point is (xi,yi,zi) - do something with it!
}
else
{
    // The point is not in the triangle.
}
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 #161 on: February 12, 2013, 02:21:00 pm »

whoops I read it totally wrong. But it didn't really matter I added the code into my own function anyway
But it still didn't work
Logged
¼

Raxx

  • Administrator
  • Hero Member
  • *****
  • Posts: 1482
    • View Profile
Re: WEEHEEEE oh, oh wait its dead, I thought it was dancing (CRE8OR NOTICE)
« Reply #162 on: February 12, 2013, 03:09:39 pm »

Doesn't Thanos's function work standalone? If it does then it's a problem with the input, and you need to recheck how you are using it.
Logged

Thanos

  • Full Member
  • ***
  • Posts: 104
  • -.-
    • View Profile
Re: WEEHEEEE oh, oh wait its dead, I thought it was dancing (CRE8OR NOTICE)
« Reply #163 on: February 12, 2013, 04:20:58 pm »

I might make a small example application as well, just to make sure it works standalone.

You know, I shouldn't be sure about anything:
Programmer's rule #1: "Thou shalt not expect thy code bug free."

EDIT: Uhh  :-[  :-X it seems it needs just a tad of debugging, I'm sorry cooldude234!!
« Last Edit: February 12, 2013, 04:27:56 pm 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 #164 on: February 13, 2013, 01:37:22 am »

Doesn't Thanos's function work standalone? If it does then it's a problem with the input, and you need to recheck how you are using it.
I might make a small example application as well, just to make sure it works standalone.

You know, I shouldn't be sure about anything:
Programmer's rule #1: "Thou shalt not expect thy code bug free."

EDIT: Uhh  :-[  :-X it seems it needs just a tad of debugging, I'm sorry cooldude234!!

Yea, it would really help if I understood the math to this whole thing. I can't tell if it's something wrong with my code, the code I based my code off of, or thanos's code or if the universe just like messing with me :S
Logged
¼
Pages: 1 ... 9 10 [11] 12 13 ... 20