glc Namespace Reference

Define render mode enum in glc namespace. More...

Enumerations

enum  WidgetEventFlag { AcceptEvent, IgnoreEvent, BlockedEvent }
 

3D widget event flag

More...
enum  RenderMode {
  NormalRenderMode, OverwriteMaterial, OverwriteTransparency, OverwriteTransparencyAndMaterial,
  PrimitiveSelected, OverwritePrimitiveMaterial, BodySelection, PrimitiveSelection
}
 

Geometry rendering mode enumeration.

More...
enum  RenderFlag { ShadingFlag = 800, WireRenderFlag, TransparentRenderFlag }
 

Geometry rendring flag enumaration.

More...

Functions

bool extensionIsSupported (const QString &)
 Return true if the extension is supported.
bool loadVboExtension ()
 Load VBO extension.
bool loadGlSlExtension ()
 Load GLSL extensions.
bool loadPointSpriteExtension ()
 Load Point Sprite extension.
GLC_LIB_EXPORT GLC_uint GLC_GenID ()
 Simple ID generation.
GLC_LIB_EXPORT GLC_uint GLC_GenGeomID ()
 Simple Geom ID generation.
GLC_LIB_EXPORT GLC_uint GLC_GenUserID ()
 Simple User ID generation.
GLC_LIB_EXPORT GLC_uint GLC_Gen3DWidgetID ()
 Simple 3D widget ID generation.
GLC_LIB_EXPORT GLC_uint GLC_GenShaderGroupID ()
 Simple shading group generation.
GLC_uint decodeRgbId (const GLubyte *)
 Return the GLC_uint decoded ID from RGB encoded ID.
void encodeRgbId (GLC_uint, GLubyte *)
 Return the encoded color of the id.
GLC_LIB_EXPORT const QString archivePrefix ()
 Return GLC_lib Archive prefix string.
GLC_LIB_EXPORT const QString archiveInfix ()
 Return GLC_lib Archive infix string.
GLC_LIB_EXPORT const QString filePrefix ()
 Return GLC_lib File prefix string.
GLC_LIB_EXPORT const QString fileInfix ()
 Return GLC_lib File infix string.
GLC_LIB_EXPORT bool isArchiveString (const QString &fileName)
 Return true if the given file name is in a archive string.
GLC_LIB_EXPORT bool isFileString (const QString &fileName)
 Return true if the given file name is in a File string.
GLC_LIB_EXPORT QString builtArchiveString (const QString &Archive, const QString &entry)
 Return archive string form the given archive fileName and fileName entry.
GLC_LIB_EXPORT QString builtFileString (const QString &File, const QString &entry)
 Return archive string form the given archive fileName and fileName entry.
GLC_LIB_EXPORT QString archiveFileName (const QString &archiveString)
 Return Archive filename from the given archive string.
GLC_LIB_EXPORT QString archiveEntryFileName (const QString &archiveString)
 Return Archive entry filname from the given archive string.
const QString version ("2.2.0")
const QString description ("GLC_lib is a Open Source C++ class library that enables the quick creation of an OpenGL application based on QT4.")
double toRadian (double angle)
 Convert the given degre angle in radian.
const GLC_Vector3d X_AXIS (1.0, 0.0, 0.0)
const GLC_Vector3d Y_AXIS (0.0, 1.0, 0.0)
const GLC_Vector3d Z_AXIS (0.0, 0.0, 1.0)
Tools Functions

GLC_LIB_EXPORT bool polygon2DIsConvex (const QList< GLC_Point2d > &vertices)
 test if the given 2D polygon is convex
GLC_LIB_EXPORT bool polygonIsConvex (QList< GLuint > *pIndexList, const QList< float > &bulkList)
 Test if the given 3d polygon is convex.
GLC_LIB_EXPORT QVector
< GLC_Point2d
findIntersection (const GLC_Point2d &, const GLC_Point2d &, const GLC_Point2d &, const GLC_Point2d &)
 find intersection between two 2D segments
GLC_LIB_EXPORT bool isIntersected (const GLC_Point2d &, const GLC_Point2d &, const GLC_Point2d &, const GLC_Point2d &)
 Return true if there is an intersection between 2 segments.
GLC_LIB_EXPORT bool isIntersectedRaySegment (const GLC_Point2d &, const GLC_Vector2d &, const GLC_Point2d &, const GLC_Point2d &)
 return true if there is an intersection between a ray and a segment
GLC_LIB_EXPORT QVector< double > findIntersection (const double &, const double &, const double &, const double &)
 Find intersection of two intervals [u0, u1] and [v0, v1].
GLC_LIB_EXPORT bool segmentInCone (const GLC_Point2d &, const GLC_Point2d &, const GLC_Point2d &, const GLC_Point2d &)
 Return true if the segment is in polygon cone.
GLC_LIB_EXPORT bool isDiagonal (const QList< GLC_Point2d > &, const int, const int)
 Return true if the segment is a polygon diagonal.
GLC_LIB_EXPORT void triangulate (QList< GLC_Point2d > &, QList< int > &, QList< int > &)
 Triangulate a polygon.
GLC_LIB_EXPORT bool isCounterclockwiseOrdered (const QList< GLC_Point2d > &)
 Return true if the polygon is couterclockwise ordered.
GLC_LIB_EXPORT void triangulatePolygon (QList< GLuint > *, const QList< float > &)
 Triangulate a polygon return true if the polygon is convex.
GLC_LIB_EXPORT bool lineIntersectPlane (const GLC_Line3d &line, const GLC_Plane &plane, GLC_Point3d *pPoint)
 Return true if the given 3d line intersect the given plane.
GLC_LIB_EXPORT GLC_Point3d project (const GLC_Point3d &point, const GLC_Line3d &line)
 Return the projected point on the given line form the given point.
GLC_Point3d midPoint (const GLC_Point3d &point1, const GLC_Point3d point2)
 Return the midpoint of the two given points.
GLC_Vector2d perpVector (const GLC_Vector2d &vect)
 Return the perpendicular 2D vector of the given 2D vector.
GLC_LIB_EXPORT double pointLineDistance (const GLC_Point3d &point, const GLC_Line3d &line)
 Return the distance between the given point and line.
GLC_LIB_EXPORT bool pointsAreCollinear (const GLC_Point3d &p1, const GLC_Point3d &p2, const GLC_Point3d &p3)
 Return true if the given 3 points are collinear.
GLC_LIB_EXPORT bool compare (double p1, double p2)
GLC_LIB_EXPORT bool compareAngle (double p1, double p2)
GLC_LIB_EXPORT bool compare (const GLC_Vector3d &v1, const GLC_Vector3d &v2)
GLC_LIB_EXPORT bool compare (const GLC_Vector2d &v1, const GLC_Vector2d &v2)
GLC_LIB_EXPORT bool compare (const QPointF &v1, const QPointF &v2)
GLC_LIB_EXPORT bool pointInPolygon (const GLC_Point2d &point, const QList< GLC_Point2d > &polygon)
 Return true if the given 2d point is inside the given polygon.
GLC_LIB_EXPORT double zeroTo2PIAngle (double angle)
 Return the angle from 0 to 2PI from an given angle from -PI to PI.

Variables

const int GLC_DISCRET = 70
const int GLC_POLYDISCRET = 60
QMutex iDMutex
QMutex geomIdMutex
QMutex userIdMutex
QMutex widget3dIdMutex
QMutex shadingGroupIdMutex
const double defaultPrecision = 0.01
double comparedPrecision = glc::defaultPrecision
const double EPSILON = 1e-10
const double PI = acos(-1.0)

Detailed Description

Define render mode enum in glc namespace.

Definition of usefull constants.


Enumeration Type Documentation

Geometry rendring flag enumaration.

Enumerator:
ShadingFlag 
WireRenderFlag 
TransparentRenderFlag 

Definition at line 54 of file glc_renderproperties.h.

Geometry rendering mode enumeration.

Enumerator:
NormalRenderMode 
OverwriteMaterial 
OverwriteTransparency 
OverwriteTransparencyAndMaterial 
PrimitiveSelected 
OverwritePrimitiveMaterial 
BodySelection 
PrimitiveSelection 

Definition at line 41 of file glc_renderproperties.h.

3D widget event flag

Enumerator:
AcceptEvent 
IgnoreEvent 
BlockedEvent 

Definition at line 85 of file glc_global.h.


Function Documentation

QString glc::archiveEntryFileName ( const QString &  archiveString  ) 
QString glc::archiveFileName ( const QString &  archiveString  ) 

Return Archive filename from the given archive string.

Definition at line 123 of file glc_global.cpp.

References archiveInfix(), archivePrefix(), fileInfix(), filePrefix(), isArchiveString(), and isFileString().

Referenced by GLC_3dxmlToWorld::create3DrepFrom3dxmlRep(), and GLC_Texture::loadFromFile().

const QString glc::archiveInfix (  ) 

Return GLC_lib Archive infix string.

Definition at line 83 of file glc_global.cpp.

Referenced by archiveEntryFileName(), archiveFileName(), builtArchiveString(), and isArchiveString().

const QString glc::archivePrefix (  ) 

Return GLC_lib Archive prefix string.

Definition at line 78 of file glc_global.cpp.

Referenced by archiveFileName(), builtArchiveString(), and isArchiveString().

QString glc::builtArchiveString ( const QString &  Archive,
const QString &  entry 
)

Return archive string form the given archive fileName and fileName entry.

Definition at line 112 of file glc_global.cpp.

References archiveInfix(), and archivePrefix().

Referenced by GLC_3dxmlToWorld::loadExternalRef3D(), GLC_3dxmlToWorld::loadExternRepresentations(), GLC_3dxmlToWorld::loadTexture(), and GLC_3dxmlToWorld::setRepresentationFileName().

QString glc::builtFileString ( const QString &  File,
const QString &  entry 
)

Return archive string form the given archive fileName and fileName entry.

Definition at line 117 of file glc_global.cpp.

References fileInfix(), and filePrefix().

Referenced by GLC_3dxmlToWorld::loadExternalRef3D(), and GLC_3dxmlToWorld::loadExternRepresentations().

bool glc::compare ( const QPointF &  v1,
const QPointF &  v2 
)

Definition at line 582 of file glc_geomtools.cpp.

References comparedPrecision.

bool glc::compare ( const GLC_Vector2d v1,
const GLC_Vector2d v2 
)

Definition at line 576 of file glc_geomtools.cpp.

References comparedPrecision, GLC_Vector2d::getX(), and GLC_Vector2d::getY().

bool glc::compare ( const GLC_Vector3d v1,
const GLC_Vector3d v2 
)
bool glc::compare ( double  p1,
double  p2 
)

Definition at line 556 of file glc_geomtools.cpp.

References comparedPrecision.

Referenced by pointsAreCollinear().

bool glc::compareAngle ( double  p1,
double  p2 
)

Definition at line 561 of file glc_geomtools.cpp.

References comparedPrecision, and toRadian().

GLC_uint glc::decodeRgbId ( const GLubyte *  pcolorId  )  [inline]

Return the GLC_uint decoded ID from RGB encoded ID.

Definition at line 129 of file glc_global.h.

Referenced by GLC_Viewport::listOfIdInsideSquare(), and GLC_Viewport::meaningfulIdInsideSquare().

const QString glc::description ( "GLC_lib is a Open Source C++ class library that enables the quick creation of an OpenGL application based on QT4."   ) 
void glc::encodeRgbId ( GLC_uint  id,
GLubyte *  colorId 
) [inline]
bool glc::extensionIsSupported ( const QString &  extension  ) 

Return true if the extension is supported.

Definition at line 41 of file glc_ext.cpp.

Referenced by GLC_State::setGlslSupport(), GLC_State::setPointSpriteSupport(), and GLC_State::setVboSupport().

const QString glc::fileInfix (  ) 

Return GLC_lib File infix string.

Definition at line 93 of file glc_global.cpp.

Referenced by archiveEntryFileName(), archiveFileName(), builtFileString(), and isFileString().

const QString glc::filePrefix (  ) 

Return GLC_lib File prefix string.

Definition at line 88 of file glc_global.cpp.

Referenced by archiveFileName(), builtFileString(), and isFileString().

QVector< double > glc::findIntersection ( const double &  u0,
const double &  u1,
const double &  v0,
const double &  v1 
)

Find intersection of two intervals [u0, u1] and [v0, v1].

Return the intersection as QVector of GLC_Vector2d

  • Empty QVector if there is no intersection
  • Qvector size 1 if there is a unique intersection
  • Qvector size 2 if the segement overlap

Definition at line 238 of file glc_geomtools.cpp.

QVector< GLC_Point2d > glc::findIntersection ( const GLC_Point2d s1p1,
const GLC_Point2d s1p2,
const GLC_Point2d s2p1,
const GLC_Point2d s2p2 
)

find intersection between two 2D segments

Return the intersection as QVector of GLC_Point2d

  • Empty QVector if there is no intersection
  • Qvector size 1 if there is a unique intersection
  • Qvector size 2 if the segement overlap

Definition at line 83 of file glc_geomtools.cpp.

References EPSILON, GLC_Vector2d::getX(), and GLC_Vector2d::getY().

Referenced by isIntersected().

GLC_uint glc::GLC_Gen3DWidgetID ( void   ) 

Simple 3D widget ID generation.

Definition at line 60 of file glc_global.cpp.

References widget3dIdMutex.

GLC_uint glc::GLC_GenGeomID ( void   ) 

Simple Geom ID generation.

Definition at line 42 of file glc_global.cpp.

References geomIdMutex.

Referenced by GLC_Geometry::operator=().

GLC_uint glc::GLC_GenID ( void   ) 

Simple ID generation.

Definition at line 33 of file glc_global.cpp.

References iDMutex.

Referenced by GLC_3DViewInstance::instanciate(), and operator>>().

GLC_uint glc::GLC_GenShaderGroupID (  ) 

Simple shading group generation.

Definition at line 69 of file glc_global.cpp.

References shadingGroupIdMutex.

GLC_uint glc::GLC_GenUserID ( void   ) 

Simple User ID generation.

Definition at line 51 of file glc_global.cpp.

References userIdMutex.

Referenced by GLC_SelectionMaterial::useMaterial().

bool glc::isArchiveString ( const QString &  fileName  ) 
bool glc::isCounterclockwiseOrdered ( const QList< GLC_Point2d > &  polygon  ) 

Return true if the polygon is couterclockwise ordered.

Definition at line 347 of file glc_geomtools.cpp.

References isIntersectedRaySegment().

Referenced by triangulatePolygon().

bool glc::isDiagonal ( const QList< GLC_Point2d > &  polygon,
const int  i0,
const int  i1 
)

Return true if the segment is a polygon diagonal.

Definition at line 285 of file glc_geomtools.cpp.

References isIntersected(), and segmentInCone().

Referenced by triangulate().

bool glc::isFileString ( const QString &  fileName  ) 

Return true if the given file name is in a File string.

Definition at line 105 of file glc_global.cpp.

References fileInfix(), and filePrefix().

Referenced by archiveEntryFileName(), archiveFileName(), GLC_3dxmlToWorld::create3DrepFrom3dxmlRep(), and GLC_WorldTo3dxml::representationFileName().

bool glc::isIntersected ( const GLC_Point2d s1p1,
const GLC_Point2d s1p2,
const GLC_Point2d s2p1,
const GLC_Point2d s2p2 
)

Return true if there is an intersection between 2 segments.

Definition at line 142 of file glc_geomtools.cpp.

References EPSILON, findIntersection(), GLC_Vector2d::getX(), and GLC_Vector2d::getY().

Referenced by isDiagonal().

bool glc::isIntersectedRaySegment ( const GLC_Point2d s1p1,
const GLC_Vector2d s1p2,
const GLC_Point2d s2p1,
const GLC_Point2d s2p2 
)

return true if there is an intersection between a ray and a segment

Definition at line 193 of file glc_geomtools.cpp.

References EPSILON, GLC_Vector2d::getX(), and GLC_Vector2d::getY().

Referenced by isCounterclockwiseOrdered().

bool glc::lineIntersectPlane ( const GLC_Line3d line,
const GLC_Plane plane,
GLC_Point3d pPoint 
)

Return true if the given 3d line intersect the given plane.

If there is an intersection point is set to the given 3d point If the line lie on the plane this method return false

Definition at line 501 of file glc_geomtools.cpp.

References GLC_Plane::coefD(), GLC_Line3d::direction(), GLC_Plane::normal(), and GLC_Line3d::startingPoint().

Referenced by GLC_RotationManipulator::doManipulate(), and GLC_PullManipulator::doManipulate().

bool glc::loadGlSlExtension (  ) 

Load GLSL extensions.

Definition at line 57 of file glc_ext.cpp.

Referenced by GLC_State::setGlslSupport().

bool glc::loadPointSpriteExtension (  ) 

Load Point Sprite extension.

Definition at line 63 of file glc_ext.cpp.

References glPointParameterf, and glPointParameterfv.

Referenced by GLC_State::setPointSpriteSupport().

bool glc::loadVboExtension (  ) 

Load VBO extension.

Definition at line 48 of file glc_ext.cpp.

Referenced by GLC_State::setVboSupport().

GLC_Point3d glc::midPoint ( const GLC_Point3d point1,
const GLC_Point3d  point2 
) [inline]

Return the midpoint of the two given points.

Definition at line 99 of file glc_geomtools.h.

GLC_Vector2d glc::perpVector ( const GLC_Vector2d vect  )  [inline]

Return the perpendicular 2D vector of the given 2D vector.

Definition at line 103 of file glc_geomtools.h.

References GLC_Vector2d::getX(), and GLC_Vector2d::getY().

bool glc::pointInPolygon ( const GLC_Point2d point,
const QList< GLC_Point2d > &  polygon 
)

Return true if the given 2d point is inside the given polygon.

Definition at line 588 of file glc_geomtools.cpp.

References GLC_Vector2d::getX(), and GLC_Vector2d::getY().

double glc::pointLineDistance ( const GLC_Point3d point,
const GLC_Line3d line 
)

Return the distance between the given point and line.

Definition at line 532 of file glc_geomtools.cpp.

References GLC_Line3d::direction(), GLC_Vector3d::length(), GLC_Vector3d::normalize(), and GLC_Line3d::startingPoint().

bool glc::pointsAreCollinear ( const GLC_Point3d p1,
const GLC_Point3d p2,
const GLC_Point3d p3 
)

Return true if the given 3 points are collinear.

Definition at line 540 of file glc_geomtools.cpp.

References compare(), and GLC_Vector3d::inverted().

bool glc::polygon2DIsConvex ( const QList< GLC_Point2d > &  vertices  ) 

test if the given 2D polygon is convex

Definition at line 38 of file glc_geomtools.cpp.

bool glc::polygonIsConvex ( QList< GLuint > *  pIndexList,
const QList< float > &  bulkList 
)

Test if the given 3d polygon is convex.

Definition at line 63 of file glc_geomtools.cpp.

References GLC_Vector3d::angleWithVect(), PI, and GLC_Vector3d::setVect().

Referenced by triangulatePolygon().

GLC_Point3d glc::project ( const GLC_Point3d point,
const GLC_Line3d line 
)

Return the projected point on the given line form the given point.

Definition at line 524 of file glc_geomtools.cpp.

References GLC_Line3d::direction(), GLC_Vector3d::normalize(), and GLC_Line3d::startingPoint().

Referenced by GLC_PullManipulator::doManipulate().

bool glc::segmentInCone ( const GLC_Point2d V0,
const GLC_Point2d V1,
const GLC_Point2d VM,
const GLC_Point2d VP 
)

Return true if the segment is in polygon cone.

Definition at line 266 of file glc_geomtools.cpp.

Referenced by isDiagonal().

double glc::toRadian ( double  angle  )  [inline]

Convert the given degre angle in radian.

Definition at line 42 of file glc_utils_maths.h.

References PI.

Referenced by compareAngle(), and GLC_Viewport::setViewAngle().

void glc::triangulate ( QList< GLC_Point2d > &  polygon,
QList< int > &  index,
QList< int > &  tList 
)

Triangulate a polygon.

Definition at line 316 of file glc_geomtools.cpp.

References isDiagonal().

Referenced by triangulatePolygon().

void glc::triangulatePolygon ( QList< GLuint > *  pIndexList,
const QList< float > &  bulkList 
)

Triangulate a polygon return true if the polygon is convex.

If the polygon is convex the returned index is a fan

Definition at line 381 of file glc_geomtools.cpp.

References isCounterclockwiseOrdered(), GLC_Vector3d::isNull(), GLC_Vector3d::normalize(), polygonIsConvex(), GLC_Matrix4x4::setMatRot(), triangulate(), and Z_AXIS().

Referenced by GLC_ColladaToWorld::addPolylistToCurrentMesh(), and GLC_ObjToWorld::extractFaceIndex().

const QString glc::version ( "2.2.0"   ) 
const GLC_Vector3d glc::X_AXIS ( 1.  0,
0.  0,
0.  0 
)
const GLC_Vector3d glc::Y_AXIS ( 0.  0,
1.  0,
0.  0 
)
const GLC_Vector3d glc::Z_AXIS ( 0.  0,
0.  0,
1.  0 
)
double glc::zeroTo2PIAngle ( double  angle  ) 

Return the angle from 0 to 2PI from an given angle from -PI to PI.

Definition at line 623 of file glc_geomtools.cpp.

References PI.


Variable Documentation

Definition at line 31 of file glc_geomtools.cpp.

Referenced by compare(), and compareAngle().

const double glc::defaultPrecision = 0.01

Definition at line 42 of file glc_geomtools.h.

const double glc::EPSILON = 1e-10

Definition at line 28 of file glc_global.cpp.

Referenced by GLC_GenGeomID().

const int glc::GLC_DISCRET = 70

Definition at line 75 of file glc_global.h.

const int glc::GLC_POLYDISCRET = 60

Definition at line 76 of file glc_global.h.

QMutex glc::iDMutex

Definition at line 27 of file glc_global.cpp.

Referenced by GLC_GenID().

const double glc::PI = acos(-1.0)

Definition at line 31 of file glc_global.cpp.

Referenced by GLC_GenShaderGroupID().

Definition at line 29 of file glc_global.cpp.

Referenced by GLC_GenUserID().

Definition at line 30 of file glc_global.cpp.

Referenced by GLC_Gen3DWidgetID().

SourceForge.net Logo

©2005-2011 Laurent Ribon