Anim8or Community

Please login or register.

Login with username, password and session length
Advanced search  

News:

An update to Anim8or, v1.00b, is available with a few bug fixes. Get your copy HERE. See the "ReadMe" file for details.

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

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

cooldude234

  • Sr. Member
  • ****
  • Posts: 901
  • 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 02, 2013, 12:49:29 am »

anyone?
Logged

Claude

  • Full Member
  • ***
  • Posts: 244
    • View Profile
Logged

cooldude234

  • Sr. Member
  • ****
  • Posts: 901
  • 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 02, 2013, 02:40:14 am »

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

Claude

  • Full Member
  • ***
  • Posts: 244
    • View Profile
Re: WEEHEEEE oh, oh wait its dead, I thought it was dancing (CRE8OR NOTICE)
« Reply #153 on: February 03, 2013, 04:09:22 pm »

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: 901
  • 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, 05: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, 05: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, 02:52:33 pm »

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, 02:54:32 pm by Thanos »
Logged

cooldude234

  • Sr. Member
  • ****
  • Posts: 901
  • 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 09, 2013, 02:50:53 am »

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, 03:26:43 pm »

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, 03:22:58 pm by Thanos »
Logged

cooldude234

  • Sr. Member
  • ****
  • Posts: 901
  • 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, 10: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, 05:29:24 am by cooldude234 »
Logged

cooldude234

  • Sr. Member
  • ****
  • Posts: 901
  • 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, 06: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, 06: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, 12:55:33 pm »

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: 901
  • 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, 07: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: 1446
    • View Profile
Re: WEEHEEEE oh, oh wait its dead, I thought it was dancing (CRE8OR NOTICE)
« Reply #162 on: February 12, 2013, 08: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, 09: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, 09:27:56 pm by Thanos »
Logged

cooldude234

  • Sr. Member
  • ****
  • Posts: 901
  • 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, 06: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