当前位置: 首页>>代码示例>>C++>>正文


C++ RotatePoint函数代码示例

本文整理汇总了C++中RotatePoint函数的典型用法代码示例。如果您正苦于以下问题:C++ RotatePoint函数的具体用法?C++ RotatePoint怎么用?C++ RotatePoint使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了RotatePoint函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: RotatePoint

void RotatePoint( wxPoint* point, const wxPoint& centre, double angle )
{
    int ox, oy;

    ox = point->x - centre.x;
    oy = point->y - centre.y;

    RotatePoint( &ox, &oy, angle );
    point->x = ox + centre.x;
    point->y = oy + centre.y;
}
开发者ID:AlexanderBrevig,项目名称:kicad-source-mirror,代码行数:11,代码来源:trigo.cpp

示例2: GetTextBox

bool TEXTE_MODULE::TextHitTest( const wxPoint& aPoint, int aAccuracy ) const
{
    EDA_RECT rect = GetTextBox( -1 );
    wxPoint location = aPoint;

    rect.Inflate( aAccuracy );

    RotatePoint( &location, GetTextPos(), -GetDrawRotation() );

    return rect.Contains( location );
}
开发者ID:zhihuitech,项目名称:kicad-source-mirror,代码行数:11,代码来源:class_text_mod.cpp

示例3: RotatePoint

void LIB_POLYLINE::Rotate( const wxPoint& aCenter, bool aRotateCCW )
{
    int rot_angle = aRotateCCW ? -900 : 900;

    size_t i, imax = m_PolyPoints.size();

    for( i = 0; i < imax; i++ )
    {
        RotatePoint( &m_PolyPoints[i], aCenter, rot_angle );
   }
}
开发者ID:JOE-JOE-NGIGI,项目名称:kicad,代码行数:11,代码来源:lib_polyline.cpp

示例4: DrawRadarArm

//Draws radar arm at new angle
void DrawRadarArm(float radAngle) {
	//Erase old line
	DrawLine(radarX, radarY, sweepArm.x, sweepArm.y, BLACK);
	//define 'north' tip position of sweep arm
	sweepArm.x=radarX;
	sweepArm.y=radarY-16;
	//Rotate point about centre
	RotatePoint(&sweepArm, radarX, radarY, radAngle);
	//Draw new arm
	DrawLine(radarX,radarY, sweepArm.x, sweepArm.y, GREEN);
}
开发者ID:RorschachUK,项目名称:Trakr,代码行数:12,代码来源:app.c

示例5: GetInterline

void EDA_TEXT::GetPositionsOfLinesOfMultilineText(
        std::vector<wxPoint>& aPositions, int aLineCount ) const
{
    wxPoint        pos  = m_Pos;  // Position of first line of the
                                  // multiline text according to
                                  // the center of the multiline text block

    wxPoint        offset;        // Offset to next line.

    offset.y = GetInterline();

    if( aLineCount > 1 )
    {
        switch( m_VJustify )
        {
        case GR_TEXT_VJUSTIFY_TOP:
            break;

        case GR_TEXT_VJUSTIFY_CENTER:
            pos.y -= ( aLineCount - 1 ) * offset.y / 2;
            break;

        case GR_TEXT_VJUSTIFY_BOTTOM:
            pos.y -= ( aLineCount - 1 ) * offset.y;
            break;
        }
    }

    // Rotate the position of the first line
    // around the center of the multiline text block
    RotatePoint( &pos, m_Pos, m_Orient );

    // Rotate the offset lines to increase happened in the right direction
    RotatePoint( &offset, m_Orient );

    for( int ii = 0; ii < aLineCount; ii++ )
    {
        aPositions.push_back( pos );
        pos += offset;
    }
}
开发者ID:Elphel,项目名称:kicad-source-mirror,代码行数:41,代码来源:eda_text.cpp

示例6: Top

void
ViewerRenderer::Isometric()
{
	Top();
	float cameraPosition[3], cameraTarget[3], cameraUp[3], axis[3], origin[3];
	GetCamera(cameraPosition, cameraTarget, cameraUp);

	axis[0] = -1.0f / (float)sqrt(2.0);
	axis[1] = 1.0f / (float)sqrt(2.0);
	axis[2] = 0;
	RotatePoint(cameraPosition, 45, cameraTarget, axis, cameraPosition);
	cameraUp[0] = -1;
	cameraUp[1] = -1;
	cameraUp[2] = 0;
	origin[0] = 0;
	origin[1] = 0;
	origin[2] = 0;
	RotatePoint(cameraUp, 45, origin, axis, cameraUp);
	
	SetCamera(cameraPosition, cameraTarget, cameraUp);
}
开发者ID:binhpt,项目名称:vltest,代码行数:21,代码来源:ViewerRenderer.cpp

示例7: AAS_TransformPlane

//===========================================================================
//
// Parameter:				-
// Returns:					-
// Changes Globals:		-
//===========================================================================
int AAS_TransformPlane(int planenum, vec3_t origin, vec3_t angles)
{
	float newdist, matrix[3][3];
	vec3_t normal;

	//rotate the node plane
	VectorCopy(mapplanes[planenum].normal, normal);
	CreateRotationMatrix(angles, matrix);
	RotatePoint(normal, matrix);
	newdist = mapplanes[planenum].dist + DotProduct(normal, origin);
	return FindFloatPlane(normal, newdist);
} //end of the function AAS_TransformPlane
开发者ID:Cpasjuste,项目名称:quake3_pandora_gles,代码行数:18,代码来源:aas_map.c

示例8: GetTextPos

void TEXTE_MODULE::Rotate( const wxPoint& aRotCentre, double aAngle )
{
    // Used in footprint edition
    // Note also in module editor, m_Pos0 = m_Pos

    wxPoint pt = GetTextPos();
    RotatePoint( &pt, aRotCentre, aAngle );
    SetTextPos( pt );

    SetTextAngle( GetTextAngle() + aAngle );
    SetLocalCoord();
}
开发者ID:zhihuitech,项目名称:kicad-source-mirror,代码行数:12,代码来源:class_text_mod.cpp

示例9: TransformRingToPolygon

/**
 * Function TransformRingToPolygon
 * Creates a polygon from a ring
 * Convert arcs to multiple straight segments
 * @param aCornerBuffer = a buffer to store the polygon
 * @param aCentre = centre of the arc or circle
 * @param aRadius = radius of the circle
 * @param aCircleToSegmentsCount = the number of segments to approximate a circle
 * @param aWidth = width (thickness) of the ring
 */
void TransformRingToPolygon( SHAPE_POLY_SET& aCornerBuffer,
                             wxPoint aCentre, int aRadius,
                             int aCircleToSegmentsCount, int aWidth )
{
    int     delta = 3600 / aCircleToSegmentsCount;   // rotate angle in 0.1 degree

    // Compute the corners posituions and creates poly
    wxPoint curr_point;
    int     inner_radius    = aRadius - ( aWidth / 2 );
    int     outer_radius    = inner_radius + aWidth;

    aCornerBuffer.NewOutline();

    // Draw the inner circle of the ring
    for( int ii = 0; ii < 3600; ii += delta )
    {
        curr_point.x    = inner_radius;
        curr_point.y    = 0;
        RotatePoint( &curr_point, ii );
        curr_point      += aCentre;
        aCornerBuffer.Append( curr_point.x, curr_point.y );
    }

    // Draw the last point of inner circle
    aCornerBuffer.Append( aCentre.x + inner_radius, aCentre.y );

    // Draw the outer circle of the ring
    for( int ii = 0; ii < 3600; ii += delta )
    {
        curr_point.x    = outer_radius;
        curr_point.y    = 0;
        RotatePoint( &curr_point, -ii );
        curr_point      += aCentre;
        aCornerBuffer.Append( curr_point.x, curr_point.y );
    }

    // Draw the last point of outer circle
    aCornerBuffer.Append( aCentre.x + outer_radius, aCentre.y );
    aCornerBuffer.Append( aCentre.x + inner_radius, aCentre.y );
}
开发者ID:bpkempke,项目名称:kicad-source-mirror,代码行数:50,代码来源:convert_basic_shapes_to_polygon.cpp

示例10: RotatePoint

void SCH_SHEET::Rotate(wxPoint aPosition)
{
    RotatePoint( &m_pos, aPosition, 900 );
    RotatePoint( &m_size.x, &m_size.y, 900 );

    if( m_size.x < 0 )
    {
        m_pos.x += m_size.x;
        m_size.x = -m_size.x;
    }

    if( m_size.y < 0 )
    {
        m_pos.y += m_size.y;
        m_size.y = -m_size.y;
    }

    for( SCH_SHEET_PIN& sheetPin : m_pins )
    {
        sheetPin.Rotate( aPosition );
    }
}
开发者ID:cpavlina,项目名称:kicad,代码行数:22,代码来源:sch_sheet.cpp

示例11: GetThickness

const EDA_RECT SCH_LABEL::GetBoundingBox() const
{
    int         linewidth = GetThickness() == 0 ? GetDefaultLineThickness() : GetThickness();
    EDA_RECT    rect = GetTextBox( -1, linewidth );

    if( GetTextAngle() != 0.0 )
    {
        // Rotate rect
        wxPoint pos = rect.GetOrigin();
        wxPoint end = rect.GetEnd();

        RotatePoint( &pos, GetTextPos(), GetTextAngle() );
        RotatePoint( &end, GetTextPos(), GetTextAngle() );

        rect.SetOrigin( pos );
        rect.SetEnd( end );

        rect.Normalize();
    }

    return rect;
}
开发者ID:johnbeard,项目名称:kicad,代码行数:22,代码来源:sch_text.cpp

示例12: RotatePoint

void C_Quaternion::RotatePoint(C_Vector3* p1 , const C_Vector3* rotationPoint) const
{
    C_Vector3 tmp;

    tmp.x = p1->x - rotationPoint->x;
    tmp.y = p1->y - rotationPoint->y;
    tmp.z = p1->z - rotationPoint->z;

    RotatePoint(&tmp);
    tmp.Translate(rotationPoint);

    p1->SetVector(tmp);
}
开发者ID:hiddenbitious,项目名称:from_scratch,代码行数:13,代码来源:quaternion.cpp

示例13: RotatePoint

void D_PAD::SetLocalCoord()
{
    MODULE* module = (MODULE*) m_Parent;

    if( module == NULL )
    {
        m_Pos0 = m_Pos;
        return;
    }

    m_Pos0 = m_Pos - module->GetPosition();
    RotatePoint( &m_Pos0.x, &m_Pos0.y, -module->GetOrientation() );
}
开发者ID:corecode,项目名称:kicad-source-mirror,代码行数:13,代码来源:class_pad.cpp

示例14: RotatePoint

// Returns the position of the pad.
wxPoint D_PAD::ShapePos() const
{
    if( m_Offset.x == 0 && m_Offset.y == 0 )
        return m_Pos;

    wxPoint loc_offset = m_Offset;

    RotatePoint( &loc_offset, m_Orient );

    wxPoint shape_pos = m_Pos + loc_offset;

    return shape_pos;
}
开发者ID:cpavlina,项目名称:kicad,代码行数:14,代码来源:class_pad.cpp

示例15: RotatePoint

/**
* Place this drawable relative to its parent
*
* This works hierarchically from top item down.
* \param offset Parent offset
* \param rotate Parent rotation
*/
void CDrawable::Place(Gdiplus::Point offset, double rotate)
{
	// Combine the transformation we are given with the transformation
	// for this object.
	mPlacedPosition = offset + RotatePoint(mPosition, rotate);
	mPlacedR = mRotation + rotate;

	// Update our children
	for (auto drawable : mChildren)
	{
		drawable->Place(mPlacedPosition, mPlacedR);
	}
}
开发者ID:maroneal1,项目名称:Canadian-Experience,代码行数:20,代码来源:Drawable.cpp


注:本文中的RotatePoint函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。