• Create Account

CaptainMurphy

Member Since 25 Mar 2009
Offline Last Active Aug 16 2014 12:31 AM

Calculate if angle between two triangles connected by edge

10 July 2014 - 12:27 AM

Hi I have two triangles sharing an edge and I have their normal vectors.

```

Na          Nb
\    F    /
\  /|\  /
\/ | \/
/\ | /\
\  |  /
\ | /
\|/
G
```

(Na and Nb are the triangle normals, F and G are their shared edge)

I want to check if the angle between the normals is: = 0, < PI, = PI or > PI.

I'm a bit rusty on 3d related math, but I looked at dot product and I don't think that works since I believe it can only be used to find the angle between 0 and PI, where as I  want between 0 and 2*PI.

I think maybe something could be done with cross product, e.g. since normals are unit length I have:

Na * Nb = sinX*V (V being the cross product, X being the angle).

But I don't know where to go from there.

I've looked at this post from a similar/same question: http://www.gamedev.net/topic/112385-detecting-if-2-triangles-are-concave-or-convex/?view=findpost&p=1604381

I presume A and B are supposed to indicate the surface normals? I''ll ut the non-orthogonality of the pictures down to the limitations of ascii art!

There may indeed be an easier method, but here is one answer to your problem. First, impose an ordering of traversal along the edge. Call A the first triangle edge and B the second triangle edge.

1) Compute the tangent vector (T) to B, so that T.NB = 0. Additionally, choose the positive direction for the tangent vector to be away from A (i.e., in the positive traversal direction)

2) Compute the components of the normal NA in the directions of T and NB, so that NA = a1T + a2NB

A is concave if a1 < 0 and convex if a1 > 0.

As I said though, there may be an easier way... I just cannot think of it at this time.

Cheers,

Timkin

But in this I don't understand what the a1 and a2 is (I'm guessing something like sinX), or what he means on the second step, compute the components?

Thanks.

windows with bash, possible to set environment paths for include, lib folders?

23 May 2012 - 12:51 AM

Hi, I'm attempting to compile boost with mingw, but it seems to be missing some headers which gnuwin32 has.

Generally any libs and header paths (that come with mingw) are automatically given when using a compiler in mingw, but I'm not sure how to pass off ones from the outside gnuwin32.

So basically is there something like a PATH environment variable for libs and headers? Also I'm running bash whilst doing this.

Thanks.

edit:
btw I've tried this:
```./bootstrap.sh CFLAGS="-IC:/programs/gnuwin32/include" CXXFLAGS="-IC:/programs/gnuwin32/include" LDFLAGS="-LC:/programs/gnuwin32/lib"
```

edit2:

After having formulated the question, I've begun to figure what I need to google for, so I'll probably solve this myself very soon.
If an admin could delete this post, thanks.

Which lib to include in my build to use 'isascii' (ctype.h)?

17 May 2012 - 12:31 PM

Hi,
I'm trying to compile (with mingw) some code using a library (clang), which in turn requires the use of 'isascii'.

But on making it I get the error message:
```'isascii' was not declared in this scope
```

Which I've been solving a lot of similar errors of functions not being found by figuring out the lib name required to be included (e.g: in the compile call: g++ myprog.cpp -o myprog.exe -lsomelib -lsomeotherlib).

But in this case I'm at a loss at what is required. Various documentation pages on isascii mention it is included with 'ctype.h' but mentions nothing on what library is required for it.

So anyone know if there is a commandline or a library that I need to include with my g++ call, thanks.

compiling ode with mingw

12 May 2012 - 05:14 AM

Hi, I've download ode 0.12 from sourceforge, and I'm trying to compile it with mingw via the bash shell (under windows 7).

I've followed the instructions in the INSTALL file, but I cannot get it to successfully make.

I tried configuring in a few different permutations:
```./configure --enable-shared --enable-double-precision
./configure --enable-shared --enable-double-precision --disable-asserts
./configure --enable-shared --enable-double-precision --disable-asserts --with-trimesh=none
```

But each time I run make, it gets stuck at this part:
```
Creating library file: .libs/libode.dll.a
libtool: link: (cd .libs/libode.lax/libfast.a && ar x "/e/code/ode-0.12/ode/src/./.libs/libfast.a")
libtool: link: object name conflicts in archive: .libs/libode.lax/libfast.a//e/code/ode-0.12/ode/src/./.libs/libfast.a
make[4]: *** [libode.la] Error 1
make[4]: Leaving directory `/e/code/ode-0.12/ode/src'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/e/code/ode-0.12/ode/src'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/e/code/ode-0.12/ode/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/e/code/ode-0.12/ode'
make: *** [all-recursive] Error 1
bash.exe"-3.1\$```

So far I haven't found anyone on google with the same problem. So anyone got a clue what the problem is?

Thanks.

Looking for a .emacs file setup for scala?

17 April 2012 - 07:58 AM

Hi, I'm trying to figure how to setup scala with emacs, so I was hoping anyone that has already done so could post me their settings from their .emacs files.

(At the moment I've downloaded scala-mode and ensime, but I'm unsure how its supposed to go. I managed to start the ensime server, but I am unsure if I'm supposed to run files in the scala-mode interpretor or via the ensime server or what.)

Thanks.

PARTNERS