This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > VRML > May 2005 > Display any vector anywhere





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Display any vector anywhere
Fenrir

2005-05-19, 7:27 pm

I want to display.vectors
First i need to calculate position, rotation of each element

In this exemple I consider a vector V with origin O
;(http://perso.wanadoo.fr/promethee60/3D/vect3.wrl)
Ox=Oy=Oz=0 V(x=30,y=30,z=30)

Vector composed from
sphere at origin
cylinder for vector body
cone for extrimity

I've tried to calculate rotation and translation but I need help

In this particular case I solve with lot of test the problem but the Problem
is that i want to display lot of vector particulary for magnetic and
electrical field, mecanichal force

..
Someone can tell me how to position element.

For sphere at origin i think coord of origin is coord of translation
sphere transform.

For cylinder body and cone extrimity?


#---------------------------------------------------------------
# Un vecteur
# Vecteur x=30 y=30 z=30
# A B C D E F G H point du pave ou le vecteur est inscrit
# display Cube VECT_CUBE wich contain vector

DEF VECT_CUBE Shape {
appearance Appearance {
material Material { diffuseColor 1 1 1}
}
geometry IndexedLineSet {
coord Coordinate {
# A B C D E F G H <=> 0 1 2 3 4 5 6 7
point [ 30 0 0, 30 0 30, 0 0 30, 0 0 0, 30 30 0,30 30 30,0
30 30,0 30 0 ]
}
coordIndex [
0,1,5,4,0,-1,2,6,7,3,2,-1,0,3,-1,1,2,-1,5,6,-1,4,7,-1]
}
}
#---------------- SPHERE AT ORIGIN -----------------------
DEF ORIGIN Shape{
geometry Sphere {radius 2}
}
#---------------- CONE AT END -----------------------
DEF VECT_END Transform { translation 31 32 31 rotation 1 0 -1 0.942
children [
Shape{
geometry Cone {bottomRadius 2 height 5 }
}
]
}
#---------------- VECTOR BODY -----------------------
DEF VECT Transform { center 0.5 -26.5 0.5 translation 0.5 26.5 0.5
rotation 1 0 -1 0.942
children [
Shape{
# racine, sqrt (30² + 30² +30²) =>
geometry Cylinder {radius 1 height 52 }
}
]
}

http://perso.wanadoo.fr/promethee60/3D/vect3.wrl



Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews