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


C++ DegToRad函数代码示例

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


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

示例1: GetValueLive

void RotationMC::GetValueLive(TimeValue t,void *val, GetSetMethod method)
	{
	Point3 pt = base;
	for (int i=0; i<3; i++) if (bind[i]) pt[i] += DegToRad(bind[i]->Eval(t));
	Quat q;
	EulerToQuat(pt,q);
	if (method==CTRL_ABSOLUTE) {		
		*((Quat*)val) = q;
	} else {
		Matrix3 *tm = (Matrix3*)val;		
		PreRotateMatrix(*tm,q);		
		}
	}
开发者ID:2asoft,项目名称:xray,代码行数:13,代码来源:rotmc.cpp

示例2: GetPerspectiveMatrix

void GetPerspectiveMatrix(M4* result, float fov, float aspect, float znear, float zfar)
{
    float rad = DegToRad(fov);
    float frustum_scale = 1.0f / (float)tan(rad / 2.0f);

    memset(result, 0, M4SIZE);
    
    result->data[0] = frustum_scale / aspect;
    result->data[5] = frustum_scale;
    result->data[10] = (zfar + znear) / (znear - zfar);
    result->data[14] = (2.0f * zfar * znear) / (znear - zfar);
    result->data[11] = -1.0f;
}
开发者ID:eygbey,项目名称:Cynfiny,代码行数:13,代码来源:g_math.c

示例3: RotateX

static glm::mat3 RotateX(float angDeg)
{
    float angRad = DegToRad(angDeg);
    float cos = cosf(angRad);
    float sin = sinf(angRad);

    glm::mat3 theMat(1.0f);
    theMat[1].y = cos;
    theMat[2].y = -sin;
    theMat[1].z = sin;
    theMat[2].z = cos;
    return theMat;
}
开发者ID:captainadamo,项目名称:glfw_gltut,代码行数:13,代码来源:Hierarchy.cpp

示例4: sinf

Matrix Matrix::CreateRotationByAxisAngle(Vector3 axis, float angle)
{
	float x = axis.x;
	float y = axis.y;
	float z = axis.z;
	
	float sin = sinf(DegToRad(-angle));
	float cos = cosf(DegToRad(-angle));

	float x2 = x*x;
	float y2 = y*y;
	float z2 = z*z;

	float xy = x*y;
	float xz = x*z;
	float yz = y*z;

	return Matrix(x2 + (cos * (1.0f - x2)), (xy - (cos * xy)) + (sin * z), (xz - (cos * xz)) - (sin * y), 0.0f,
		(xy - (cos * xy)) - (sin * z), y2 + (cos * (1.0f - y2)), (yz - (cos * yz)) + sin * x, 0.0f,
		(xz - (cos * xz)) + sin * y, (yz - (cos * yz)) - sin * x, z2 + (cos * (1.0f - z2)), 0.0f,
		0.0f, 0.0f, 0.0f, 1.0f);	
}
开发者ID:ariabonczek,项目名称:DSATriangleThing,代码行数:22,代码来源:Matrix.cpp

示例5: Lock

void FreqCircle::UpdateBars(){
	//Exclusive Lock this object while bars are updated.
	//Fill our buffer with frequency information
	Lock();
	FrequencyAnalysis::Instance().Fill(buffer, specLeft, specRight);

	//Apply the correct transformations to the children (the bars)
	for (unsigned int i = 0; i< children.size(); ++i){

		float angle = ((float) i / accuracy) * 360;
		float modification = (float) i+1.0f;

		float value = clamp(buffer[i] * modification , 0.0f, 1.0f);

		//This method is threadsafe, no children locks necessary
		children[i]->SetModelMatrix(
			Matrix4::Translation(Vector3(
			value * cos(DegToRad( angle )),
			value * sin(DegToRad( angle )), -0.05f)));
	}
	Unlock();
}
开发者ID:Matth3wThomson,项目名称:S3-Project,代码行数:22,代码来源:FreqCircle.cpp

示例6: directionVector

void RenderHelper::DrawCircle3D(const Vector3 & center, const Vector3 &emissionVector, float32 radius, bool useFilling)
{
	Polygon3 pts;
    float32 angle = SEGMENT_LENGTH / radius;
	int ptsCount = (int)(PI_2 / (DegToRad(angle))) + 1;

	for (int k = 0; k < ptsCount; ++k)
	{
		float32 angleA = ((float)k / (ptsCount - 1)) * PI_2;
		float sinAngle = 0.0f;
		float cosAngle = 0.0f;
		SinCosFast(angleA, sinAngle, cosAngle);

		Vector3 directionVector(radius * cosAngle,
								radius * sinAngle,
								0.0f);
		
		// Rotate the direction vector according to the current emission vector value.
		Vector3 zNormalVector(0.0f, 0.0f, 1.0f);
		Vector3 curEmissionVector = emissionVector;
		curEmissionVector.Normalize();
		
		// This code rotates the (XY) plane with the particles to the direction vector.
		// Taking into account that a normal vector to the (XY) plane is (0,0,1) this
		// code is very simplified version of the generic "plane rotation" code.
		float32 length = curEmissionVector.Length();
		if (FLOAT_EQUAL(length, 0.0f) == false)
		{
			float32 cosAngleRot = curEmissionVector.z / length;
			float32 angleRot = acos(cosAngleRot);
			Vector3 axisRot(curEmissionVector.y, -curEmissionVector.x, 0);

			Matrix3 planeRotMatrix;
			planeRotMatrix.CreateRotation(axisRot, angleRot);
			Vector3 rotatedVector = directionVector * planeRotMatrix;
			directionVector = rotatedVector;
		}
		
		Vector3 pos = center - directionVector;
		pts.AddPoint(pos);
	}
	
	if (useFilling)
	{
		FillPolygon(pts);
	}
	else
	{
    	DrawPolygon(pts, false);
	}
}
开发者ID:droidenko,项目名称:dava.framework,代码行数:51,代码来源:RenderHelper.cpp

示例7: AddForceByName

HRESULT CPartEmitter::AddForce(char *Name, CPartForce::TForceType Type, int PosX, int PosY, float Angle, float Strength) {
	CPartForce *Force = AddForceByName(Name);
	if (!Force) return E_FAIL;

	Force->m_Type = Type;
	Force->m_Pos = Vector2(PosX, PosY);

	Force->m_Direction = Vector2(0, Strength);
	Matrix4 MatRot;
	MatRot.RotationZ(DegToRad(CBUtils::NormalizeAngle(Angle - 180)));
	MatRot.TransformVector2(Force->m_Direction);

	return S_OK;
}
开发者ID:somaen,项目名称:Wintermute-git,代码行数:14,代码来源:PartEmitter.cpp

示例8: E_IMPL_NEW

//---------------------------------------------------------------------------
GrProjection::GrProjection()
: E_IMPL_NEW( GrProjection )
, m_fFovY( DegToRad(60.0F) )
, m_fAspect( 1.0F )
, m_fZNear( 1.0F )
, m_fZFar( 0.0F )
, m_fFarCull( 10000.0F )
, m_fLeft( -1.0F )
, m_fRight( 1.0F )
, m_fBottom( -1.0F )
, m_fTop( 1.0F )
, m_bDirty( true )
{
}
开发者ID:jjiezheng,项目名称:arachnid,代码行数:15,代码来源:gr_projection.cpp

示例9: sin

void CStage::Draw(){

	/*for(int x=0;x<width;x++){
		for(int y=0;y<height;y++){

		}
	}*/
	if (quakeFlag && pauseFlag == false) {
		gStage->Draw(cos(DegToRad((double)GetRand(360)))*20, sin(DegToRad((double)GetRand(360))) * 20,num);
	}
	else {
		gStage->Draw(num);
	}
	quakeFlag = false;
	DrawJiki();
	enemy.Draw();
	barrageManager.Draw();
	enemy.enemyBarrage.Draw();
	jikiBarrage->Draw();
	gScore->Draw();
	DrawScore();
	DrawIcon();
}
开发者ID:photon70,项目名称:BTB,代码行数:23,代码来源:Stage.cpp

示例10: DegToRad

bool EC_MeshmoonWater::AddWind(float speed, float direction)
{
#ifndef MESHMOON_TRITON
    return false;
#else
    if(framework->IsHeadless() || !state_.environment)
        return false;

    Triton::WindFetch fetch;
    fetch.SetWind(speed, DegToRad(direction));
    state_.environment->AddWindFetch(fetch);
    return true;
#endif
}
开发者ID:Adminotech,项目名称:meshmoon-plugins,代码行数:14,代码来源:EC_MeshmoonWater.cpp

示例11: PROFILE

void EC_MeshmoonWater::UpdateWeatherConditions()
{
#ifdef MESHMOON_TRITON
    if (!state_.environment)
        return;

    PROFILE(EC_MeshmoonWater_UpdateWeatherConditions);

    state_.environment->ClearWindFetches();
    state_.environment->SimulateSeaState(beaufortScale.Get(), DegToRad(fmod(state_.windDirDegrees, 360.0f)));
    if (state_.windSpeedPerSec != 0.0f)
        AddWind(state_.windSpeedPerSec, state_.windDirDegrees);
#endif
}
开发者ID:Adminotech,项目名称:meshmoon-plugins,代码行数:14,代码来源:EC_MeshmoonWater.cpp

示例12: eye_world

ROSE_NAMESPACE_START

    PinholeCamera::PinholeCamera(const Vector3f &eye, const Vector3f &at, const Vector3f &up,
                                 float fov, uint32_t w, uint32_t h)
            : eye_world(eye), width(w), height(h) {
        // Compute cameras view volume
        top = std::tan(DegToRad(fov / 2.f));
        bottom = -top;
        right = (width / (float) height) * top;
        left = -right;

        // Compute look at matrix
        look_at = LookAt(eye, at, up);
    }
开发者ID:SRaimondi,项目名称:Rose,代码行数:14,代码来源:pinhole_camera.cpp

示例13: D3DXMatrixRotationYawPitchRoll

HRESULT CBObject::GetMatrix(D3DXMATRIX* ModelMatrix, D3DXVECTOR3* PosVect)
{
	if(PosVect==NULL) PosVect = &m_PosVector;

	D3DXMATRIX matRot, matScale, matTrans;
	D3DXMatrixRotationYawPitchRoll(&matRot, DegToRad(m_Angle), 0, 0);
	D3DXMatrixScaling(&matScale, m_Scale3D, m_Scale3D, m_Scale3D);

	D3DXMatrixTranslation(&matTrans, PosVect->x, PosVect->y, PosVect->z);
	D3DXMatrixMultiply(ModelMatrix, &matRot, &matScale);
	D3DXMatrixMultiply(ModelMatrix, ModelMatrix, &matTrans);

	return S_OK;
}
开发者ID:segafan,项目名称:wme1_jankavan_tlc_edition-repo,代码行数:14,代码来源:BObject.cpp

示例14: GetRandomNumber

void Item::SpawnSubItems()
{
	int numItems = GetRandomNumber(2, 4);

	if(m_itemType == eItem_Chest)
	{
		numItems += 3; // Spawn more coins
	}

	for(int i = 0; i < numItems; i++)
	{
		float scale = 0.15f;
		float lifeTime = 1.0f;
		float r = 0.13f;
		float g = 0.65f;
		float b = 1.0f;
		float a = 1.0f;

		float radius = 0.5f;
		//float angle = DegToRad(((float)i/(float)numItems) * 360.0f);
		float angle = DegToRad(GetRandomNumber(0, 360, 1));
		vec3 ItemPosition = GetCenter() + vec3(cos(angle) * radius, 0.0f, sin(angle) * radius);

		vec3 gravity = vec3(0.0f, -1.0f, 0.0f);
		gravity = normalize(gravity);
		Item* pItem = NULL;
		ItemSubSpawnData *pItemSubSpawnData = m_pItemManager->GetItemSubSpawnData(m_itemType);
		if(pItemSubSpawnData != NULL)
		{
			pItem = m_pItemManager->CreateItem(GetCenter(), vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f), pItemSubSpawnData->m_spawnedItemFilename.c_str(), pItemSubSpawnData->m_spawnedItem, pItemSubSpawnData->m_spawnedItemTitle.c_str(), pItemSubSpawnData->m_interactable, pItemSubSpawnData->m_collectible, pItemSubSpawnData->m_scale);

			if(pItem != NULL)
			{
				pItem->SetGravityDirection(gravity);
				vec3 vel = ItemPosition - GetCenter();
				pItem->SetVelocity(normalize(vel)*(float)GetRandomNumber(2, 4, 2) + vec3(0.0f, 9.5f+GetRandomNumber(-2, 4, 2), 0.0f));
				pItem->SetRotation(vec3(0.0f, GetRandomNumber(0, 360, 2), 0.0f));
				pItem->SetAngularVelocity(vec3(0.0f, 90.0f, 0.0f));

				if(pItemSubSpawnData->m_droppedItemItem != eItem_Coin)
				{
					pItem->SetDroppedItem(pItemSubSpawnData->m_droppedItemFilename.c_str(), pItemSubSpawnData->m_droppedItemTextureFilename.c_str(), pItemSubSpawnData->m_droppedItemInventoryType, pItemSubSpawnData->m_droppedItemItem, pItemSubSpawnData->m_droppedItemStatus, pItemSubSpawnData->m_droppedItemEquipSlot, pItemSubSpawnData->m_droppedItemQuality, pItemSubSpawnData->m_droppedItemLeft, pItemSubSpawnData->m_droppedItemRight, pItemSubSpawnData->m_droppedItemTitle.c_str(), pItemSubSpawnData->m_droppedItemDescription.c_str(), pItemSubSpawnData->m_droppedItemPlacementR, pItemSubSpawnData->m_droppedItemPlacementG, pItemSubSpawnData->m_droppedItemPlacementB, pItemSubSpawnData->m_droppedItemQuantity);
				}

				pItem->SetAutoDisappear(20.0f + (GetRandomNumber(-20, 20, 1) * 0.2f));
			}
		}
	}
}
开发者ID:AlwaysGeeky,项目名称:Vox,代码行数:49,代码来源:Item.cpp

示例15: GetCurrentPoint

// draws a an arc to two tangents connecting (current) to (x1,y1) and (x1,y1) to (x2,y2), also a straight line from (current) to (x1,y1)
void wxGraphicsPathData::AddArcToPoint( wxDouble x1, wxDouble y1 , wxDouble x2, wxDouble y2, wxDouble r )
{   
    wxPoint2DDouble current;
    GetCurrentPoint(&current.m_x,&current.m_y);
    wxPoint2DDouble p1(x1,y1);
    wxPoint2DDouble p2(x2,y2);

    wxPoint2DDouble v1 = current - p1;
    v1.Normalize();
    wxPoint2DDouble v2 = p2 - p1;
    v2.Normalize();

    wxDouble alpha = v1.GetVectorAngle() - v2.GetVectorAngle();

    if ( alpha < 0 )
        alpha = 360 + alpha;
    // TODO obtuse angles

    alpha = DegToRad(alpha);

    wxDouble dist = r / sin(alpha/2) * cos(alpha/2);
    // calculate tangential points
    wxPoint2DDouble t1 = dist*v1 + p1;
    wxPoint2DDouble t2 = dist*v2 + p1;

    wxPoint2DDouble nv1 = v1;
    nv1.SetVectorAngle(v1.GetVectorAngle()-90);
    wxPoint2DDouble c = t1 + r*nv1;

    wxDouble a1 = v1.GetVectorAngle()+90;
    wxDouble a2 = v2.GetVectorAngle()-90;

    AddLineToPoint(t1.m_x,t1.m_y);
    AddArc(c.m_x,c.m_y,r,DegToRad(a1),DegToRad(a2),true);
    AddLineToPoint(p2.m_x,p2.m_y);
}
开发者ID:252525fb,项目名称:rpcs3,代码行数:37,代码来源:graphcmn.cpp


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