本文整理汇总了C++中DegreesToRadians函数的典型用法代码示例。如果您正苦于以下问题:C++ DegreesToRadians函数的具体用法?C++ DegreesToRadians怎么用?C++ DegreesToRadians使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DegreesToRadians函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DirectInput
bool DX10_Camera_FirstPerson::Initialise(DX10_Renderer* _pRenderer, HINSTANCE _hInstance, HWND _hWnd)
{
m_pRenderer = _pRenderer;
m_pDirectInput = new DirectInput();
VALIDATE(m_pDirectInput->Initialise(_hInstance, _hWnd));
m_position = D3DXVECTOR3(0.0f, 25.0f, -50.0f);
m_target = D3DXVECTOR3(0.0f, 0.0f, 0.0f);
m_up = D3DXVECTOR3(0.0f, 1.0f, 0.0f);
m_forward = D3DXVECTOR3(0.0f, 0.0f, 1.0f);
m_right = D3DXVECTOR3(1.0f, 0.0f, 0.0f);
m_defaultForward = D3DXVECTOR3(0.0f, 0.0f, 1.0f);
m_defaultRight = D3DXVECTOR3(1.0f, 0.0f, 0.0f);
m_moveStrafe = 0.0f;
m_moveForwards = 0.0f;
m_moveFly = 0.0f;
m_yaw = 0.0f;
m_pitch = DegreesToRadians(30.0f);
m_yawChange = 0.0f;
m_pitchChange = 0.0f;
m_speed = 20.0f;
m_rotSpeed = DegreesToRadians(90.0f);
m_maxRotation = DegreesToRadians(89.0f);
m_minRotation = DegreesToRadians(-89.0f);
Process(0.016f);
return true;
}
示例2: getToken
Transform* SceneParser::parseTransform() {
char token[MAX_PARSER_TOKEN_LENGTH];
Matrix matrix; matrix.SetToIdentity();
Object3D *object = NULL;
getToken(token); assert(!strcmp(token, "{"));
// read in transformations:
// apply to the LEFT side of the current matrix (so the first
// transform in the list is the last applied to the object)
getToken(token);
while (1) {
if (!strcmp(token, "Scale")) {
matrix *= Matrix::MakeScale(readVec3f());
}
else if (!strcmp(token, "UniformScale")) {
float s = readFloat();
matrix *= Matrix::MakeScale(Vec3f(s, s, s));
}
else if (!strcmp(token, "Translate")) {
matrix *= Matrix::MakeTranslation(readVec3f());
}
else if (!strcmp(token, "XRotate")) {
matrix *= Matrix::MakeXRotation(DegreesToRadians(readFloat()));
}
else if (!strcmp(token, "YRotate")) {
matrix *= Matrix::MakeYRotation(DegreesToRadians(readFloat()));
}
else if (!strcmp(token, "ZRotate")) {
matrix *= Matrix::MakeZRotation(DegreesToRadians(readFloat()));
}
else if (!strcmp(token, "Rotate")) {
getToken(token); assert(!strcmp(token, "{"));
Vec3f axis = readVec3f();
float degrees = readFloat();
matrix *= Matrix::MakeAxisRotation(axis, DegreesToRadians(degrees));
getToken(token); assert(!strcmp(token, "}"));
}
else if (!strcmp(token, "Matrix")) {
Matrix matrix2; matrix2.SetToIdentity();
getToken(token); assert(!strcmp(token, "{"));
for (int j = 0; j < 4; j++) {
for (int i = 0; i < 4; i++) {
float v = readFloat();
matrix2.Set(i, j, v);
}
}
getToken(token); assert(!strcmp(token, "}"));
matrix = matrix2 * matrix;
}
else {
// otherwise this must be an object,
// and there are no more transformations
object = parseObject(token);
break;
}
getToken(token);
}
assert(object != NULL);
getToken(token); assert(!strcmp(token, "}"));
return new Transform(matrix, object);
}
示例3:
void Magick::Options::transformRotation(double angle_)
{
AffineMatrix
affine,
current=_drawInfo->affine;
affine.sx=1.0;
affine.rx=0.0;
affine.ry=0.0;
affine.sy=1.0;
affine.tx=0.0;
affine.ty=0.0;
affine.sx=cos(DegreesToRadians(fmod(angle_,360.0)));
affine.rx=(-sin(DegreesToRadians(fmod(angle_,360.0))));
affine.ry=sin(DegreesToRadians(fmod(angle_,360.0)));
affine.sy=cos(DegreesToRadians(fmod(angle_,360.0)));
_drawInfo->affine.sx=current.sx*affine.sx+current.ry*affine.rx;
_drawInfo->affine.rx=current.rx*affine.sx+current.sy*affine.rx;
_drawInfo->affine.ry=current.sx*affine.ry+current.ry*affine.sy;
_drawInfo->affine.sy=current.rx*affine.ry+current.sy*affine.sy;
_drawInfo->affine.tx=current.sx*affine.tx+current.ry*affine.ty+current.tx;
_drawInfo->affine.ty=current.rx*affine.tx+current.sy*affine.ty+current.ty;
}
示例4: addPortalGun
void WeaponHUD::addPortalGun() {
ref_ptr<Node> portalGun = osgDB::readNodeFile("../BlenderFiles/exports/Portalgun.ive");
/*
* rotating and translating the portal gun to the lower
* right of the screen
*/
ref_ptr<MatrixTransform> portalGunTransform = new MatrixTransform;
portalGunTransform->setMatrix(
Matrix::rotate(osg::DegreesToRadians(0.0), X_AXIS)
*Matrix::rotate(DegreesToRadians(0.0), Y_AXIS)
*Matrix::rotate(DegreesToRadians(90.0), Z_AXIS)
*Matrix::translate(osg::Vec3(0.7f, 1.5f, -1.3f))
);
portalGunTransform->addChild(portalGun);
/*
* Set proper lighting and reflection
*/
brtr::ModifyMaterialVisitor mmv;
mmv.setAmbient(Vec4(1.3, 1.3, 1.3, 1)).setShininess(42).setSpecular(Vec4(0.4, 0.4, 0.4, 1));
portalGun->accept(mmv);
_switcher->setAllChildrenOff();
_switcher->addChild(portalGunTransform, true);
}
示例5: Draw_rotation_eq
/*
Method: Magick::Draw#rotation=degrees
Purpose: set rotation attribute value
Notes: Taken from Magick++'s Magick::Image::annotate method
Copyright Bob Friesenhahn, 1999, 2000, 2001, 2002
*/
VALUE
Draw_rotation_eq(VALUE self, VALUE deg)
{
Draw *draw;
double degrees;
AffineMatrix affine, current;
rb_check_frozen(self);
Data_Get_Struct(self, Draw, draw);
degrees = NUM2DBL(deg);
if (fabs(degrees) > DBL_EPSILON)
{
affine.sx=1.0;
affine.rx=0.0;
affine.ry=0.0;
affine.sy=1.0;
affine.tx=0.0;
affine.ty=0.0;
current = draw->info->affine;
affine.sx=cos(DegreesToRadians(fmod(degrees,360.0)));
affine.rx=sin(DegreesToRadians(fmod(degrees,360.0)));
affine.ry=(-sin(DegreesToRadians(fmod(degrees,360.0))));
affine.sy=cos(DegreesToRadians(fmod(degrees,360.0)));
draw->info->affine.sx=current.sx*affine.sx+current.ry*affine.rx;
draw->info->affine.rx=current.rx*affine.sx+current.sy*affine.rx;
draw->info->affine.ry=current.sx*affine.ry+current.ry*affine.sy;
draw->info->affine.sy=current.rx*affine.ry+current.sy*affine.sy;
draw->info->affine.tx=current.sx*affine.tx+current.ry*affine.ty+current.tx;
}
return self;
}
示例6: VCPoint2D
VCPoint2D* ViceGeom::PlacePointFrom(VCPoint2D* point, float angle, float distance) {
VCPoint2D* result = new VCPoint2D();
result->x = point->x + sin(DegreesToRadians(angle)) * distance;
result->y = point->y + cos(DegreesToRadians(angle)) * distance;
return result;
}
示例7: getToken
Transform *
SceneParser::parseTransform()
{
char token[MAX_PARSER_TOKEN_LENGTH];
Matrix4f matrix = Matrix4f::identity();
Object3D *object = NULL;
getToken(token); assert(!strcmp(token, "{"));
// read in transformations:
// apply to the LEFT side of the current matrix (so the first
// transform in the list is the last applied to the object)
getToken(token);
while (true) {
if (!strcmp(token,"Scale")) {
Vector3f s = readVector3f();
matrix = matrix * Matrix4f::scaling( s[0], s[1], s[2] );
} else if (!strcmp(token,"UniformScale")) {
float s = readFloat();
matrix = matrix * Matrix4f::uniformScaling( s );
} else if (!strcmp(token,"Translate")) {
matrix = matrix * Matrix4f::translation( readVector3f() );
} else if (!strcmp(token,"XRotate")) {
matrix = matrix * Matrix4f::rotateX((float) DegreesToRadians(readFloat()));
} else if (!strcmp(token,"YRotate")) {
matrix = matrix * Matrix4f::rotateY((float) DegreesToRadians(readFloat()));
} else if (!strcmp(token,"ZRotate")) {
matrix = matrix * Matrix4f::rotateZ((float) DegreesToRadians(readFloat()));
} else if (!strcmp(token,"Rotate")) {
getToken(token); assert(!strcmp(token, "{"));
Vector3f axis = readVector3f();
float degrees = readFloat();
float radians = (float) DegreesToRadians(degrees);
matrix = matrix * Matrix4f::rotation(axis,radians);
getToken(token); assert(!strcmp(token, "}"));
} else if (!strcmp(token,"Matrix4f")) {
Matrix4f matrix2 = Matrix4f::identity();
getToken(token); assert(!strcmp(token, "{"));
for (int j = 0; j < 4; j++) {
for (int i = 0; i < 4; i++) {
float v = readFloat();
matrix2( i, j ) = v;
}
}
getToken(token); assert(!strcmp(token, "}"));
matrix = matrix2 * matrix;
} else {
// otherwise this must be an object,
// and there are no more transformations
object = parseObject(token);
break;
}
getToken(token);
}
assert(object != NULL);
getToken(token); assert(!strcmp(token, "}"));
return new Transform(matrix, object);
}
示例8: VRotate2D
Vector VRotate2D( float angle, Vector u)
{
float x,y;
x = u.x * cos(DegreesToRadians(-angle)) + u.y * sin(DegreesToRadians(-angle));
y = -u.x * sin(DegreesToRadians(-angle)) + u.y * cos(DegreesToRadians(-angle));
return Vector( x, y, 0);
}
示例9: sinf
void CShapeRenderer::DrawSphere(const CVec3& pos, float fRadius, float fElliptical, CColor color, uint32_t uGridCnt, bool bWireFrame) const
{
if (BEATS_FLOAT_GREATER(fRadius, 0.0F))
{
const uint32_t uVertexCnt = uGridCnt + 1;
std::vector<CVertexPC> vertices;
std::vector<unsigned short> indices;
// Generate vertex.
for (uint32_t y = 0; y < uVertexCnt; y++)
{
for (uint32_t x = 0; x < uVertexCnt; x++)
{
CVertexPC vertex;
vertex.color = color;
vertex.position.X() = sinf(DegreesToRadians((float)y / (float)(uVertexCnt - 1) * 180.0F)) *
cosf(DegreesToRadians((float)x / (float)(uVertexCnt - 1) * 360.0F)) *
fRadius;
vertex.position.Y() =
cosf(DegreesToRadians((float)y / (float)(uVertexCnt - 1) * 180.0F)) *
fRadius *
fElliptical;
vertex.position.Z() =
sinf(DegreesToRadians((float)y / (float)(uVertexCnt - 1) * 180.0F)) *
sinf(DegreesToRadians((float)x / (float)(uVertexCnt - 1) * 360.0F)) *
fRadius;
vertex.position += pos;
vertices.push_back(vertex);
}
}
// Generate index.
for (uint32_t z = 0; z < uGridCnt; z++)
{
for (uint32_t x = 0; x < uGridCnt; x++)
{
indices.push_back((unsigned short)(z * uVertexCnt + x));
indices.push_back((unsigned short)((z + 1) * uVertexCnt + x + 1));
indices.push_back((unsigned short)((z + 1) * uVertexCnt + x));
indices.push_back((unsigned short)(z * uVertexCnt + x));
indices.push_back((unsigned short)(z * uVertexCnt + x + 1));
indices.push_back((unsigned short)((z + 1) * uVertexCnt + x + 1));
}
}
if (bWireFrame)
{
CRenderManager::GetInstance()->RenderLines(vertices, indices, 1.0f, true);
}
else
{
CRenderManager::GetInstance()->RenderTriangle(vertices, indices, true);
}
}
}
示例10: GetDistance
// calculates the distance between two coordinates in nautical miles
static double GetDistance(double latiudeA, double longitudeA, double latiudeB, double longitudeB)
{
double dLatitude = latiudeB - latiudeA;
double dLongitude = longitudeB - longitudeA;
double a = pow(sin(DegreesToRadians(dLatitude / 2.0)), 2) + cos(DegreesToRadians(latiudeA)) * cos(DegreesToRadians(latiudeB)) * pow(sin(DegreesToRadians(dLongitude / 2.0)), 2);
double c = 2.0 * atan2(sqrt(a), sqrt(1.0 - a));
return c * RADIUS_EARTH;
}
示例11: cos
void Lights::SetLightSpotLight(int index, float radius, const Vector3Df& dir, float outAngle, float inAngle)
{
if(IsIndexValid(index))
{
m_radius[index] = radius;
m_dir[index] = dir;
m_angleInnerCone[index] = cos(DegreesToRadians(inAngle));
m_angleOuterCone[index] = cos(DegreesToRadians(outAngle));
}
}
示例12: tEulerCamera
tCamera::tCamera():
tEulerCamera()
{
m_MinElevation = DegreesToRadians(1);
m_MaxElevation = DegreesToRadians(90);
m_MinX = -19970325L;
m_MaxX = 19970325L;
m_MinY = -20616952L;
m_MaxY = 17947623L;
}
示例13: sin
double Elbow::GetCurrentArbFeedForward(void) {
double wristEffectiveAngle;
double wristArbFF;
double curArbFeedForward;
// Wrist adjustment for effect on Elbow
wristEffectiveAngle = Robot::wrist->GetCurrentDegrees() + m_curDegrees - 180.0;
wristArbFF = sin(DegreesToRadians(wristEffectiveAngle)) * m_wristArbFF;
curArbFeedForward = sin(DegreesToRadians(m_curDegrees)) * (m_arbFeedForward + wristArbFF);
return curArbFeedForward;
}
示例14:
void tSonar3D::ResetCameraToHome()
{
m_CameraDistanceMeters = cDefaultCameraDistanceMeters;
m_CameraRelativeAngleDegrees = 0;
m_TrackBallInteractor
.SetTarget(m_Target)
.SetAzimuth(DegreesToRadians(HeadingToCartesianAngle(m_SceneSettings.vesselHeading)))
.SetElevation(DegreesToRadians(cDefaultElevationDegrees))
.SetDistance(m_CameraDistanceMeters)
.UpdateCamera();
}
示例15: DegreesToRadians
float MathHelper::Sin(float angle, bool radians)
{
if ( !radians )
angle = DegreesToRadians( angle );
return float( sin( angle ) );
}