Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I'm fresh in C, need your help

Status
Not open for further replies.

midnight09

Programmer
Nov 12, 2009
6
CZ
Hello, guys, I'm new in C, and I have to test one program , but it's in C , its source is
jgt.akpeters.com/papers/Moller97/tritri.html and I need your help, how can I call int tri_tri_intersect_with_isectline? Thanx a lot.
 
Code:
int tri_tri_intersect_with_isectline(float V0[3],float V1[3],float V2[3],
				     float U0[3],float U1[3],float U2[3],int *coplanar,
				     float isectpt1[3],float isectpt2[3])
Well, it looks pretty clear to me. Do you know about arrays & pointers yet? If not, you should probably learn those first.

I have no idea what the function does, but I would guess something like this:
Code:
float V0[3] = {1.0f, 2.0f, 3.0f};
float V1[3] = {1.1f, 2.1f, 3.1f};
float V2[3] = {1.2f, 2.2f, 3.2f};
float U0[3] = {1.3f, 2.3f, 3.3f};
float U1[3] = {1.4f, 2.4f, 3.4f};
float U2[3] = {1.5f, 2.5f, 3.5f};
float isectpt1[3] = {1.6f, 2.6f, 3.6f};
float isectpt2[3] = {1.7f, 2.7f, 3.7f};
int coplanar = 0;

tri_tri_intersect_with_isectline(
 V0, V1, V2, U0, U1, U2, &coplanar, isectpt1, isectpt2
);
 
Cpjust is correct. The function is explicit in its declaration. You need to call it, passing the correct parameters, which are mostly three dimensional vectors of type float.

As an aside, I took a quick look at the code referenced in the original post. As a point of reference, using the #define to declare decent sized functions as a macro is a TERRIBLE idea. It is a bad idea because it is almost guaranteed to cause you trouble with compilation and run time bugs. If you have control of this code, you should consider reworking it after spending some time researching proper coding standards.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top