00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "Ellipsoid.h"
00020
00021 namespace uvsim
00022 {
00023
00024 Ellipsoid::Ellipsoid(osg::Vec3d radii, osg::Vec3d center, int spriteSize,
00025 osg::Vec4d color)
00026 {
00027 points = new osg::Vec3Array;
00028 colors = new osg::Vec4Array;
00029 pointCloud = new PointCloud(spriteSize,points.get(),colors.get());
00030 for (double phi=0; phi<PI; phi+=PI/64)
00031 {
00032 for (double theta=0; theta<2*PI; theta+=PI/32)
00033 {
00034 points->push_back(osg::Vec3d(
00035 radii.x()*sin(phi)*cos(theta)+center.x(),
00036 radii.y()*sin(phi)*sin(theta)+center.y(),
00037 radii.z()*cos(phi)+center.z()));
00038 colors->push_back(color);
00039 }
00040 }
00041 pointCloud->updateSize();
00042 }
00043
00044 Ellipsoid::~Ellipsoid()
00045 {
00046 }
00047
00048 }
00049
00050
00051