VRMLへの変換  convert.m

Loading Package

Remove["Global`*"]Needs["VRMLConvert`"]

Converted to VRML

\(g = 
      ParametricPlot3D\ [
        \ {\ v\ Cos\ [u]\ Sin\ [v]\ , 
			v\ Sin\ [u]\ Sin\ [v]\ , \ 
          v\ Cos\ [v]\ }\ , 
		\ {\ u\ , \ 0.5\ Pi\ , \ 2.5\ Pi\ }\ , 
        \ {\ v\ , \ 0\ , \ Pi\ }, 
		\ ViewPoint\  -> \ {2, 2, 0}\ ]\ ; 

    VRMLConvert[g, \ \ "apple.wrl"\ \ ]\)

g = 
      ParametricPlot3D [
         { ( 2  +  0.5 Cos [u] ) Cos [v] ,  
          ( 2  +  0.5 Cos [u] ) Sin [v] ,  0.5 Sin [u] } , 
         { u ,  0.5 Pi ,  2.5 Pi } ,  { v ,  0 ,  2 Pi } ]
         \(VRMLConvert[g, \ "torus.wrl", 
\ \ 
      SurfaceMaterial\  -> \ SurfaceColor[RGBColor[0.5, \ 0.5, \ 0.0]]]\)

g = 
      ParametricPlot3D [ { t ,  u ,  Sin [t u] } , 
         { t ,  -3 ,  3 } ,  { u ,  -3 ,  3 } ] \(VRMLConvert[g, \ "triangle.wrl", 
\ \ 
      SurfaceMaterial\  -> \ SurfaceColor[RGBColor[0.5, \ 0.5, \ 0.0]]]\)

f [ x_ ,  y_ ]  :=  
      ( x ^ 2  +  3 y ^ 2 ) 
        Exp [ 1  -  x ^ 2  -  y ^ 2 ] g = 
      Plot3D [ f [ x ,  y ] ,  { x ,  -2 ,  2 } , 
         { y ,  -2.5 ,  2.5 }  ] \(VRMLConvert[g, 
\ \ \ \ "twin.wrl", 
\ \ \ 
      SurfaceMaterial\  -> 
        \ {SurfaceColor[RGBColor[1, 1, 0]], 

          \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 
          SurfaceColor[RGBColor[1, 0, 0]]}, 
\ \ \ \ 
      PointStyle\  -> \ Sphere, \ SphereSize\  -> \ 0.05, 
\ \ \ \ 
      LightSources\  -> 
        \ {{{\ 1, \ 0, \ 1}, \ RGBColor[1, 0, 0]}, 

          			{{\ 1, \ 1, \ 1}, \ RGBColor[0, 1, 0]}, 

          			{{\ 0, \ 1, \ 1}, \ RGBColor[0, 0, 1]}, 

          			{{\ \(-1\), \(-1\), \ \(-1\)}, \ RGBColor[1, 1, 1]}
		}\ ]
      \)