コード例 #1
0
void PMCone::createPoints( PMPointArray& points, const PMVector& end1,
                               const PMVector& end2, double radius1, double radius2, int steps )
{

   double angle = ( 2.0 * M_PI ) / (double) steps;

   PMVector pointAt = end2 - end1;
   double pl = pointAt.abs( );
   if( approxZero( pl ) )
      pointAt = PMVector( 0.0, 1.0, 0.0 );
   else
      pointAt /= pl;

   PMMatrix rotation = PMMatrix::rotation( pointAt, angle );
   PMVector endPoint1 = pointAt.orthogonal( );
   endPoint1 *= radius1;
   PMVector endPoint2 = pointAt.orthogonal( );
   endPoint2 *= radius2;

   int i;
   for( i = 0; i < steps; i++ )
   {
      points[i] = PMPoint( endPoint1 + end1 );
      points[i + steps] = PMPoint( endPoint2 + end2 );
      endPoint1 = rotation * endPoint1;
      endPoint2 = rotation * endPoint2;
   }
}
コード例 #2
0
PMDistanceControlPoint::PMDistanceControlPoint( PMControlPoint* base,
        const PMVector& direction, double distance,
        int id, const QString& description,
        bool showExtraLine )
    : PMControlPoint( id, description )
{
    m_distance = distance;
    m_pBasePoint = base;
    m_direction = direction;
    m_directionLength = direction.abs( );
    m_extraLine = showExtraLine;
}
コード例 #3
0
void PMDistanceControlPoint::setDirection( const PMVector& direction )
{
    m_direction = direction;
    m_directionLength = direction.abs( );
}