glc_point.cpp

Go to the documentation of this file.
00001 /****************************************************************************
00002 
00003  This file is part of the GLC-lib library.
00004  Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
00005  http://glc-lib.sourceforge.net
00006 
00007  GLC-lib is free software; you can redistribute it and/or modify
00008  it under the terms of the GNU Lesser General Public License as published by
00009  the Free Software Foundation; either version 3 of the License, or
00010  (at your option) any later version.
00011 
00012  GLC-lib is distributed in the hope that it will be useful,
00013  but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  GNU Lesser General Public License for more details.
00016 
00017  You should have received a copy of the GNU Lesser General Public License
00018  along with GLC-lib; if not, write to the Free Software
00019  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00020 
00021 *****************************************************************************/
00022 
00024 
00025 #include "glc_point.h"
00026 #include "../glc_openglexception.h"
00027 
00028 using namespace glc;
00030 // Constructor Destructor
00032 
00033 
00034 GLC_Point::GLC_Point(const GLC_Point3d &setCoord)
00035 :GLC_PointCloud()
00036 , m_Coordinate(setCoord)
00037 , m_Size(1.0f)
00038 {
00039         setCoordinate(m_Coordinate);
00040 }
00041 
00042 GLC_Point::GLC_Point(double x, double y, double z)
00043 :GLC_PointCloud()
00044 , m_Coordinate(x, y, z)
00045 , m_Size(1.0f)
00046 {
00047         setCoordinate(m_Coordinate);
00048 }
00049 
00050 GLC_Point::GLC_Point(const GLC_Point& point)
00051 :GLC_PointCloud(point)
00052 , m_Coordinate(point.m_Coordinate)
00053 , m_Size(point.m_Size)
00054 {
00055 
00056 }
00057 
00059 // Get Functions
00061 
00062 // Get a 4D point represent point coordinate
00063 GLC_Point3d GLC_Point::coordinate(void) const
00064 {
00065         return m_Coordinate;
00066 }
00067 
00068 // Return a copy of the current geometry
00069 GLC_Geometry* GLC_Point::clone() const
00070 {
00071         return new GLC_Point(*this);
00072 }
00073 
00075 // Set Functions
00077 
00078 // Set Point coordinate by 4D Vector
00079 void GLC_Point::setCoordinate(const GLC_Point3d &point)
00080 {
00081         m_Coordinate= point;
00082         GLC_PointCloud::clear();
00083         QList<GLC_Point3d> points;
00084         points.append(m_Coordinate);
00085         GLC_PointCloud::addPoint(points);
00086 
00087 }
00088 // Set Point coordinate by 3 double
00089 void GLC_Point::setCoordinate(double x, double y, double z)
00090 {
00091         setCoordinate(GLC_Point3d(x, y, z));
00092 }
00093 
00095 // OpenGL Functions
00097 
00098 void GLC_Point::glDraw(const GLC_RenderProperties& renderProperties)
00099 {
00100         glPointSize(m_Size);
00101         // Point Display
00102         GLC_PointCloud::glDraw(renderProperties);
00103 }
00104 

SourceForge.net Logo

©2005-2011 Laurent Ribon