LouiZeForum
Would you like to react to this message? Create an account in a few clicks or log in to continue.
LouiZeForum

3D vrml
 
HomeHome  SearchSearch  Latest imagesLatest images  RegisterRegister  Log in  3Dchats / forums3Dchats / forums  
-20%
Le deal à ne pas rater :
Pack Gigabyte Ecran PC Gamer 27″ LED M27Q (rev2.0) + Radeon RX 6950 ...
749 € 939 €
Voir le deal

 

 Le chouan / Promethée

Go down 
3 posters
Go to page : Previous  1, 2
AuthorMessage
Le Chouan
1/20



Number of posts : 2
Registration date : 2006-12-18

Le chouan / Promethée - Page 2 Empty
PostSubject: Erratum   Le chouan / Promethée - Page 2 EmptyWed 17 Jan - 0:23

L'exemple du vecteur comporte une erreur.
En fait il ne représenterait pas correctement un vecteur ayant des composantes négatives.




Je vais corriger la page. J'ai crée un PROTOtype ,les calculs sont faits dans le proto; voici le code corrigé et prototypé cheers :

notez le test sur V.y

if(V.y < 0){
RANGLE = Math.PI - RANGLE;
}

Ce n'est pas un version définitive, il faut je pense plutot se servir de la fonction tangente plutot que du sinus. Des suggestions ??

Code:

#VRML V2.0 utf8
PROTO Vector [
   field SFVec3f VectorOrigin 0 0 0
   field SFVec3f VectorCoordinate 0 0 0
   field SFString VectorName "Vector"
   field SFInt32 VectorIndex 0
   ]
   
{
DEF   ROOT Transform {
   }

 Script {
   field SFString VN IS VectorName
   field SFInt32 VIDX IS VectorIndex   

   field SFVec3f O IS VectorOrigin
   field SFVec3f V IS VectorCoordinate
   field SFFloat NORMV 0

   field SFVec3f U 0 1 0
   
   field SFVec3f RV 0 0 0
   field SFFloat NORMRV 0
   
   field SFFloat RANGLE 0
   
   field SFNode ROOT USE ROOT
   
   url "javascript:
   
      function initialize(){
         print('debug : init for proto');
         print('debug : name of vector := ' + VN);
         print('debug : index of vector := ' + VIDX);         
         print('debug : vector origin :: x= ' + O.x + ' y= ' + O.y + ' z= ' + O.z);
         print('debug : vector :: x= ' + V.x + ' y= ' + V.y + ' z= ' + V.z);   
         NORMV = Math.sqrt((V.x*V.x) + (V.y*V.y) + (V.z*V.z));
         print('debug : vector norm :: norm = ' + NORMV);
         RV = U.cross(V);
         print('debug : cross product, RV :: x= ' + RV.x + ' y= ' + RV.y + ' z= ' + RV.z);
         NORMRV = Math.sqrt((RV.x * RV.x) + (RV.y * RV.y) + (RV.z * RV.z));
         print('debug : rotation vector norm :: norm = ' + NORMRV);   
         RANGLE = Math.asin(NORMRV/NORMV);
         if(V.y < 0){
            RANGLE =  Math.PI - RANGLE;
            }
         
         print('debug : rotation angle = ' + RANGLE);
         print(GenerateVector());
         var newNode = Browser.createVrmlFromString(GenerateVector());
         ROOT.addChildren = newNode;
         
         
            
      }
         
      function GenerateVector(){
         var sTemp = 'DEF ' + VN + ' Transform {';
         sTemp+= '  children [';
         sTemp+= '      Transform {';
         sTemp+= '        translation '+ O.x + ' ' + O.y + ' ' + O.z;
         sTemp+= '               children [';         
         sTemp+= '            Shape{   geometry Sphere {radius 2} }';
         sTemp+= '        ]';   
         sTemp+= '      }';         
         sTemp+= '      Transform {';
         sTemp+= '        center 0 ' + (-0.5 * NORMV) + ' 0 ';
         sTemp+= '        translation ' + O.x + ' ' + (O.y + (0.5 * NORMV)) + ' ' + O.z;
         sTemp+= '        rotation ' + RV.x + ' ' + RV.y + ' ' + RV.z + ' ' + RANGLE;
         sTemp+= '               children [';
         sTemp+= '                 Shape{';   
         sTemp+= '                     appearance Appearance {';
         sTemp+= '                   material Material { diffuseColor 0.47 0.85 0.21}';
         sTemp+= '                  }';
         sTemp+= '                  geometry Cylinder {radius 1 height ' + NORMV +' } ';
         sTemp+= '            }';
         sTemp+= '        ]';   
         sTemp+= '      }';                     
         sTemp+= '      Transform {';
         sTemp+= '        translation '+ (O.x + V.x) + ' '+ ( O.y + V.y ) + ' ' + (O.z + V.z);
         sTemp+= '        rotation ' + RV.x + ' ' + RV.y + ' ' + RV.z +' ' + RANGLE;         
         sTemp+= '               children [';
         sTemp+= '                 Shape{';   
         sTemp+= '                     geometry Cone {bottomRadius 2 height 5 }';
         sTemp+= '            }';                        
         sTemp+= '        ]';   
         sTemp+= '      }';            
         sTemp+= '  ]';   
         sTemp+= '}';
         return sTemp;
         }
      
      "
 }
}
fichier : vector1.wrl

Pour tester le proto un monde simple

Code:
#VRML V2.0 utf8

EXTERNPROTO Vector [
field SFVec3f VectorOrigin
field SFVec3f VectorCoordinate   
field SFString VectorName
field SFInt32 VectorIndex
]
"vector1.wrl"

   
   

#*** GENERALITES **************************************************

NavigationInfo {
   type ["WALK"]
   avatarSize [.1 1.6 2]
   headlight FALSE
   speed 5
}

Background{
   skyAngle [  1.1 1.57 ]
   skyColor [  .3 .3 1 .4 .4 1 .7 .7 .9 ]
}

DirectionalLight {
   direction 0 -.5 -1
   intensity 1
}
DirectionalLight {
   direction -1 -.5 .5
   intensity .9
}
DirectionalLight {
   direction 1 -.5 .5
   intensity .8
}

#*** MONDE ********************************************************

Viewpoint {
   position 0 1.6 10
   description   "Entry"
}

Viewpoint {
   position 50 200 50
   orientation   1 0 0 -1.54
   description   "Plan"
}

#-------------------------------------------------------
#  SYSTEME D AXE AVEC DIFFERENTES COULEUR

DEF REP Shape {   
   geometry IndexedLineSet   {
      coord Coordinate {
         point [   0 0 0, 20 0 0, 0 20 0, 0 0 20]
      }
      coordIndex [ 0,1,-1, 0,2,-1, 0,3,-1   ]
      color Color   {
         color [1 0 0, 0 1 0, 0 0 1]
      }
      colorIndex [0,1,2]
      colorPerVertex FALSE
   }
   
}
#-----------------------------------------------------------------
# ELEMENTS AXES X
# Cone + Text
DEF CREP_X Transform {
   translation   19.5 0 0
   rotation 0 0 1 -1.57
   children [
      Shape {
         appearance Appearance {   material Material {   diffuseColor 1 0 0} }
         geometry Cone { bottomRadius 0.25 height 1
         }
      }
   ]
}
DEF CREP_XL Transform {
   translation   21 0 0
   children [
      Shape {
           appearance Appearance {   material Material {   diffuseColor 1 0 0} }

         geometry Text { string "Axe X"}
      }
   ]
}
#-----------------------------------------------------------------
# ELEMENTS AXES Y
# Cone + Text

DEF CREP_Y Transform {
   translation   0 19.5 0
   children [
      Shape {
         appearance Appearance {   
            material Material {   diffuseColor 0 1 0}
         }

         geometry Cone {
            bottomRadius 0.25 height 1
         }
      }
   ]
}
DEF CREP_YL Transform {
   translation   0 21 0
   children [
      Shape {
           appearance Appearance {   material Material {   diffuseColor 0 1  0} }

         geometry Text { string "Axe Y"}
      }
   ]
}
#-----------------------------------------------------------------
# ELEMENTS AXES Z
# Cone + Text

DEF CREP_Z Transform {
   translation   0 0 19.5
   rotation 1 0 0 1.57
   children [
      Shape {
         appearance Appearance {   material Material {   diffuseColor 0 0 1} }
         geometry Cone { bottomRadius 0.25 height 1
         }
      }
   ]
}
DEF CREP_ZL Transform {
   translation   0 0 21
   children [
      Shape {
           appearance Appearance {   material Material {   diffuseColor 0 0 1} }

         geometry Text { string "Axe Z"}
      }
   ]
}
#-----------------------------------------------------------------
# LES VECTEURS

DEF VECTOR1 Vector {
        VectorOrigin -5 0 -10
        VectorCoordinate 20 40 60
        VectorName "VECTOR1"
        VectorIndex 1
      }
DEF VECTOR2 Vector {
        VectorOrigin 2 0 10
        VectorCoordinate 20 20 20
        VectorName "VECTOR2"
        VectorIndex 2
      }
DEF VECTOR4 Vector {
        VectorOrigin 2 0 10
        VectorCoordinate -20 -20 -20
        VectorName "VECTOR4"
        VectorIndex 4
      }     
     
     
DEF VECTOR3 Vector {
        VectorOrigin 12 0 10
        VectorCoordinate 80 -80 80
        VectorName "VECTOR3"
        VectorIndex 3
      }     
DEF VECTOR5 Vector {
        VectorOrigin 12 0 10
        VectorCoordinate -80 80 80
        VectorName "VECTOR5"
        VectorIndex 5
      }
     
DEF VECTOR6 Vector {
        VectorOrigin 12 0 10
        VectorCoordinate 80 80 -80
        VectorName "VECTOR6"
        VectorIndex 6
      }     
DEF VECTOR7 Vector {
        VectorOrigin 12 0 10
        VectorCoordinate -80 -80 -80
        VectorName "VECTOR7"
        VectorIndex 7
      }               


fichier testvecteur.wrl
Back to top Go down
alain
fondateur
fondateur
alain


Number of posts : 23529
Localisation : Dompierre sur Veyle ,France
Registration date : 2005-04-19

Le chouan / Promethée - Page 2 Empty
PostSubject: Re: Le chouan / Promethée   Le chouan / Promethée - Page 2 EmptyWed 17 Jan - 0:51

bah moi j'aime bien regarder les codes ,
....et rencontrer des gens sur le net ,
que je rencontrerais pas dans mon quartier ,
même si etc etc
....
et si ça gêne jacinto , j'arrêterai ,
je vais pas risquer de perdre un ami ....

mais bon ,
j'ai testé ( si ça gêne j'enleverai , c'est pas en latin )

http://dumenieu.free.fr/louiseforum/lechouanvector.wrl

Le chouan / Promethée - Page 2 Lechouanvector


faut dire quand même que je comprends rien aux maths , hein ,

mais ..bon..j'avais quand même fait a peu près pareil avec un de mes chats Smile

Le chouan / Promethée - Page 2 Chat3d
Back to top Go down
alain
fondateur
fondateur
alain


Number of posts : 23529
Localisation : Dompierre sur Veyle ,France
Registration date : 2005-04-19

Le chouan / Promethée - Page 2 Empty
PostSubject: Re: Le chouan / Promethée   Le chouan / Promethée - Page 2 EmptyWed 7 Mar - 10:34

vu sur web3d-fr

ça me semble être dans les intérêts de jacinto et Jack

http://www.web3d-fr.com/foroum/index.php?s=327d150c8204bf582eb56e1e52e7102d&showtopic=3689&pid=15471&st=0&#entry15471

je n'ai pas eu encore le temps de faire beaucoup de mails pour avertir de la nouvelle adresse de Louize ..

par ex pas fait pour Le Chouan .....

on aboutit ici :

http://perso.orange.fr/promethee60/data/technos/adamat/adamat.html
Back to top Go down
Sponsored content





Le chouan / Promethée - Page 2 Empty
PostSubject: Re: Le chouan / Promethée   Le chouan / Promethée - Page 2 Empty

Back to top Go down
 
Le chouan / Promethée
Back to top 
Page 2 of 2Go to page : Previous  1, 2

Permissions in this forum:You cannot reply to topics in this forum
LouiZeForum :: ARTS :: 3D art :: 3D gallery-
Jump to: