void OpenSteer::PolylineSegmentedPathwaySegmentRadii::setSegmentRadii( size_type startIndex, size_type numOfRadii, float const radii[] ) { assert( startIndex < segmentCount() && "startIndex out of range." ); assert( startIndex + numOfRadii <= segmentCount() && "Too many radii to set." ); assert( allRadiiNonNegative( radii, radii + numOfRadii ) && "All radii must be positive or zero." ); std::copy( radii, radii + numOfRadii, segmentRadii_.begin() + startIndex ); }
/*! \fn QString QVersionNumber::toString() const Returns a string with all of the segments delimited by a '.'. \sa majorVersion(), minorVersion(), microVersion(), segments() */ QString QVersionNumber::toString() const { QString version; version.reserve(qMax(segmentCount() * 2 - 1, 0)); bool first = true; for (int i = 0; i < segmentCount(); ++i) { if (!first) version += QLatin1Char('.'); version += QString::number(segmentAt(i)); first = false; } return version; }
void ChaseWidget::paintEvent(QPaintEvent *event) { Q_UNUSED(event); QPainter p(this); if (m_pixmapEnabled && !m_pixmap.isNull()) { p.drawPixmap(0, 0, m_pixmap); return; } const int extent = qMin(width() - 8, height() - 8); const int displ = extent / 4; const int ext = extent / 4 - 1; p.setRenderHint(QPainter::Antialiasing, true); if(m_animated) p.setPen(Qt::gray); else p.setPen(QPen(palette().dark().color())); p.translate(width() / 2, height() / 2); // center for (int segment = 0; segment < segmentCount(); ++segment) { p.rotate(QApplication::isRightToLeft() ? m_step : -m_step); if(m_animated) p.setBrush(colorForSegment(segment)); else p.setBrush(palette().background()); p.drawEllipse(QRect(displ, -ext / 2, ext, ext)); } }
OpenSteer::Vec3 OpenSteer::PolylineSegmentedPath::mapSegmentDistanceToTangent( size_type segmentIndex, float ) const { assert( segmentIndex < segmentCount() && "segmentIndex is out of range." ); return segmentTangents_[ segmentIndex ]; }
OpenSteer::Vec3 OpenSteer::PolylineSegmentedPath::segmentStart( size_type segmentIndex ) const { assert( segmentIndex < segmentCount() && "segmentIndex out of range." ); assert( segmentIndex < pointCount() && "The max. index of a point must be inside range." ); return points_[ segmentIndex ]; }
float OpenSteer::PolylineSegmentedPathwaySegmentRadii::mapSegmentDistanceToRadius( size_type segmentIndex, float distanceOnSegment ) const { OPENSTEER_UNUSED_PARAMETER(distanceOnSegment); assert( segmentIndex < segmentCount() && "segmentIndex out of range." ); return segmentRadii_[ segmentIndex ]; }
void OpenSteer::PolylineSegmentedPathwaySegmentRadii::setSegmentRadius( size_type segmentIndex, float r ) { assert( segmentIndex < segmentCount() && "segmentIndex out of range." ); assert( 0.0f <= r && "No negative radii allowed." ); segmentRadii_[ segmentIndex ] = r; }
void ImageLoader::getMappedRegions(MappedRegion*& regions) const { for(unsigned int i=0, e=segmentCount(); i < e; ++i) { MappedRegion region; region.address = segActualLoadAddress(i); region.size = segSize(i); *regions++ = region; } }
bool ImageLoader::containsAddress(const void* addr) const { for(unsigned int i=0, e=segmentCount(); i < e; ++i) { const uint8_t* start = (const uint8_t*)segActualLoadAddress(i); const uint8_t* end = (const uint8_t*)segActualEndAddress(i); if ( (start <= addr) && (addr < end) && !segUnaccessible(i) ) return true; } return false; }
void OpenSteer::PolylineSegmentedPathwaySegmentRadii::mapDistanceToSegmentPointAndTangentAndRadius( size_type segmentIndex, float distance, Ogre::Vector3& pointOnPath, Ogre::Vector3& tangent, float& radius ) const { assert( segmentIndex < segmentCount() && "segmentIndex out of range." ); path_.mapDistanceToSegmentPointAndTangent( segmentIndex, distance, pointOnPath, tangent ); radius = segmentRadii_[ segmentIndex ]; }
float OpenSteer::PolylineSegmentedPath::mapPointToSegmentDistance( size_type segmentIndex, Vec3 const& point ) const { assert( segmentIndex < segmentCount() && "segmentIndex is out of range." ); Vec3 const segmentStartToPoint( point - points_[ segmentIndex ] ); float const distance = segmentStartToPoint.dot( segmentTangents_[ segmentIndex ] ); return clamp( distance, 0.0f, segmentLengths_[ segmentIndex ] ); }
void OpenSteer::PolylineSegmentedPath::mapPointToSegmentDistanceAndPointAndTangent( size_type segmentIndex, Vec3 const& point, float& distance, Vec3& pointOnPath, Vec3& tangent ) const { assert( segmentIndex < segmentCount() && "segmentIndex is out of range." ); Vec3 const segmentStartPoint = points_[ segmentIndex ]; Vec3 const segmentStartToPoint( point - segmentStartPoint ); tangent = segmentTangents_[ segmentIndex ]; distance = segmentStartToPoint.dot( tangent ); distance = clamp( distance, 0.0f, segmentLengths_[ segmentIndex ] ); pointOnPath = tangent * distance + segmentStartPoint; }
OpenSteer::Vec3 OpenSteer::PolylineSegmentedPath::mapSegmentDistanceToPoint( size_type segmentIndex, float segmentDistance ) const { assert( segmentIndex < segmentCount() && "segmentIndex is out of range." ); float const segmentLength = segmentLengths_[ segmentIndex ]; /* * bk: remove behavior that treats negative numbers as distances beginning * from the end of the segment if ( 0.0f > segmentDistance ) { segmentDistance += segmentLength; } */ segmentDistance = clamp( segmentDistance, 0.0f, segmentLength ); return segmentTangents_[ segmentIndex ] * segmentDistance + points_[ segmentIndex ]; }
bool ImageLoader::overlapsWithAddressRange(const void* start, const void* end) const { for(unsigned int i=0, e=segmentCount(); i < e; ++i) { const uint8_t* segStart = (const uint8_t*)segActualLoadAddress(i); const uint8_t* segEnd = (const uint8_t*)segActualEndAddress(i); if ( strcmp(segName(i), "__UNIXSTACK") == 0 ) { // __UNIXSTACK never slides. This is the only place that cares // and checking for that segment name in segActualLoadAddress() // is too expensive. segStart -= getSlide(); segEnd -= getSlide(); } if ( (start <= segStart) && (segStart < end) ) return true; if ( (start <= segEnd) && (segEnd < end) ) return true; if ( (segStart < start) && (end < segEnd) ) return true; } return false; }
QColor ChaseWidget::colorForSegment(int seg) const { int index = ((seg + m_segment) % segmentCount()); int comp = qMax(0, 255 - (index * (255 / segmentCount()))); return QColor(comp, comp, comp, 255); }
float OpenSteer::PolylineSegmentedPath::segmentLength( size_type segmentIndex ) const { assert( segmentIndex < segmentCount() && "segmentIndex out of range." ); return segmentLengths_[ segmentIndex ]; }
QT_BEGIN_NAMESPACE /*! \class QVersionNumber \inmodule QtCore \since 5.6 \brief The QVersionNumber class contains a version number with an arbitrary number of segments. \snippet qversionnumber/main.cpp 0 */ /*! \fn QVersionNumber::QVersionNumber() Produces a null version. \sa isNull() */ /*! \fn QVersionNumber::QVersionNumber(int maj) Constructs a QVersionNumber consisting of just the major version number \a maj. */ /*! \fn QVersionNumber::QVersionNumber(int maj, int min) Constructs a QVersionNumber consisting of the major and minor version numbers \a maj and \a min, respectively. */ /*! \fn QVersionNumber::QVersionNumber(int maj, int min, int mic) Constructs a QVersionNumber consisting of the major, minor, and micro version numbers \a maj, \a min and \a mic, respectively. */ /*! \fn QVersionNumber::QVersionNumber(const QVector<int> &seg) Constructs a version number from the list of numbers contained in \a seg. */ /*! \fn QVersionNumber::QVersionNumber(QVector<int> &&seg) Move-constructs a version number from the list of numbers contained in \a seg. This constructor is only enabled if the compiler supports C++11 move semantics. */ /*! \fn QVersionNumber::QVersionNumber(std::initializer_list<int> args) Construct a version number from the std::initializer_list specified by \a args. This constructor is only enabled if the compiler supports C++11 initializer lists. */ /*! \fn bool QVersionNumber::isNull() const Returns \c true if there are zero numerical segments, otherwise returns \c false. \sa segments() */ /*! \fn bool QVersionNumber::isNormalized() const Returns \c true if the version number does not contain any trailing zeros, otherwise returns \c false. \sa normalized() */ /*! \fn int QVersionNumber::majorVersion() const Returns the major version number, that is, the first segment. This function is equivalent to segmentAt(0). If this QVersionNumber object is null, this function returns 0. \sa isNull(), segmentAt() */ /*! \fn int QVersionNumber::minorVersion() const Returns the minor version number, that is, the second segment. This function is equivalent to segmentAt(1). If this QVersionNumber object does not contain a minor number, this function returns 0. \sa isNull(), segmentAt() */ /*! \fn int QVersionNumber::microVersion() const Returns the micro version number, that is, the third segment. This function is equivalent to segmentAt(2). If this QVersionNumber object does not contain a micro number, this function returns 0. \sa isNull(), segmentAt() */ /*! \fn const QVector<int>& QVersionNumber::segments() const Returns all of the numerical segments. \sa majorVersion(), minorVersion(), microVersion() */ QVector<int> QVersionNumber::segments() const { if (m_segments.isUsingPointer()) return *m_segments.pointer_segments; QVector<int> result; result.resize(segmentCount()); for (int i = 0; i < segmentCount(); ++i) result[i] = segmentAt(i); return result; }
float OpenSteer::PolylineSegmentedPathwaySegmentRadii::segmentRadius( size_type segmentIndex ) const { assert( segmentIndex < segmentCount() && "segmentIndex out of range." ); return segmentRadii_[ segmentIndex ]; }