fun project/ help me verify my graphics project! 
Author Message
 fun project/ help me verify my graphics project!

Hey gang,

I am writing a subdivision app in OpenGL, and one of the steps along the
way is finding the adjacent triangle for each vertex.  What this comes
down to is:  for Triangle1-Vertrex1, you want to find another Triangle
that has Triangle1-Vertex2 and Triangle1-Vertex3 that _isn't_
Triangle1!!!  I think I've done it correctly, but I would love if
someone would write an awk script to verify this;  the file is set up as
such::

numFaces numVerticies
2 4 5
.                                //these are the face triples,
indicating what verticies make up the triangle
.
.
.
.0234 .3243 .2343
.
.
.                                //these are the 3d coordinates of the
verticies
.
.

I don't know the caliber of awk-writers here, but if someone can produce
this for me before tomorrow, they will earn a  prize!

Later,
Nick



Wed, 21 Sep 2005 08:40:56 GMT  
 fun project/ help me verify my graphics project!

Quote:

> numFaces numVerticies
> 2 4 5
> .                                //these are the face triples,
> indicating what verticies make up the triangle
> .
> .
> .
> .0234 .3243 .2343
> .
> .
> .                                //these are the 3d coordinates of the
> verticies
> .
> .
> I don't know the caliber of awk-writers here, but if someone can produce
> this for me before tomorrow, they will earn a  prize!

There are for sure some people very knowledgeable with awk in this ng.
However, it would make things easier if you post some example data
and the desired output. Didn't understand what you want to do at all.

--
Michael Heiming

Remove +SIGNS and www. if you expect an answer, sorry for
inconvenience, but I get tons of SPAM



Wed, 21 Sep 2005 16:20:56 GMT  
 fun project/ help me verify my graphics project!


Quote:
>Hey gang,

>I am writing a subdivision app in OpenGL, and one of the steps along the
>way is finding the adjacent triangle for each vertex.  What this comes
>down to is:  for Triangle1-Vertrex1, you want to find another Triangle
>that has Triangle1-Vertex2 and Triangle1-Vertex3 that _isn't_
>Triangle1!!!  I think I've done it correctly, but I would love if
>someone would write an awk script to verify this;  the file is set up as
>such::

>numFaces numVerticies
>2 4 5
>.                                //these are the face triples,
>indicating what verticies make up the triangle
>.
>.
>.
>.0234 .3243 .2343
>.
>.
>.                                //these are the 3d coordinates of the
>verticies
>.
>.

>I don't know the caliber of awk-writers here, but if someone can produce
>this for me before tomorrow, they will earn a  prize!

>Later,
>Nick

Data file tri.dat:-

8 9
1 2 4
2 4 5
2 5 3
5 3 6
4 5 7
5 7 8
5 6 8
6 8 9
0.0 0.0 0.0
1.0 0.0 0.0
2.0 0.0 0.0
0.0 1.0 0.0
1.0 1.0 0.0
2.0 1.0 0.0
0.0 2.0 0.0
1.0 2.0 0.0
2.0 2.0 0.0

Awk program tri.awk:-

F == 0 {
  F = $1
  V = $2
  next

Quote:
}

f<F {
  f++
  faces[$1] = faces[$1] " " f
  faces[$2] = faces[$2] " " f
  faces[$3] = faces[$3] " " f
  next

Quote:
}

v<V {
  v++
  x[v]=$1
  y[v]=$2
  z[v]=$3
  next

Quote:
}

{
  printf "%6s %8s %8s %8s  %-s\n", "Vertex","X","Y","Z","Faces"
  for (i=1; i<=V; i++) {
    printf "%6d %8.2f %8.2f %8.2f %s\n", i,x[i],y[i],z[i],faces[i]
  }
  exit

Quote:
}

Results:-

C:\cygwin\home\default\MyAwk>awk -f tri.awk tri.dat
Vertex        X        Y        Z  Faces
     1     0.00     0.00     0.00  1
     2     1.00     0.00     0.00  1 2 3
     3     2.00     0.00     0.00  3 4
     4     0.00     1.00     0.00  1 2 5
     5     1.00     1.00     0.00  2 3 4 5 6 7
     6     2.00     1.00     0.00  4 7 8
     7     0.00     2.00     0.00  5 6
     8     1.00     2.00     0.00  6 7 8
     9     2.00     2.00     0.00  8

C:\cygwin\home\default\MyAwk>

Hope this helps,
--
Alan Linton



Wed, 21 Sep 2005 17:00:12 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Open Source Ansii Smalltalk Fun Project Idea

2. Project Manager for Server based DBMS projects - World Wide

3. Interesting Project (And an Excellent Project for Promoting Eiffel)

4. Project: Free OS and Other Projects Continued

5. Project Lead (Modernization Project)

6. Seeking Minimal Python Project Name (was: [pypy-dev] Re: [ann] MinimalPython project)

7. Eiffel Graphics Library Project

8. TkGS Project to define a new Graphics Subsystem for Tk

9. Project : 3d graphic interface in Ada...

10. Help Help Speed Up Project

11. Help Help Speed Up Project -Reply

12. count bits, fun fun fun.

 

 
Powered by phpBB® Forum Software