L
L
Legebocker2018-02-21 19:11:04
C++ / C#
Legebocker, 2018-02-21 19:11:04

What expression is needed for ToRadian?

There is one function. Its name is ToRadian(). I sat quietly very quietly, but decided to stand out when working with the camera.
The construction of the hero of this celebration The code on which the compiler bumps:
#define ToRadian(x) ((x) * M_PI / 180.0f)

void Matrix4f::InitRotateTransform(float RotateX, float RotateY, float RotateZ)
{
  Matrix4f rx, ry, rz;

  const float x = ToRadian(RotateX);
  const float y = ToRadian(RotateY);
  const float z = ToRadian(RotateZ);

  rx.m[0][0] = 1.0f; rx.m[0][1] = 0.0f; rx.m[0][2] = 0.0f; rx.m[0][3] = 0.0f;
  rx.m[1][0] = 0.0f; rx.m[1][1] = cosf(x); rx.m[1][2] = -sinf(x); rx.m[1][3] = 0.0f;
  rx.m[2][0] = 0.0f; rx.m[2][1] = sinf(x); rx.m[2][2] = cosf(x); rx.m[2][3] = 0.0f;
  rx.m[3][0] = 0.0f; rx.m[3][1] = 0.0f; rx.m[3][2] = 0.0f; rx.m[3][3] = 1.0f;

  ry.m[0][0] = cosf(y); ry.m[0][1] = 0.0f; ry.m[0][2] = -sinf(y); ry.m[0][3] = 0.0f;
  ry.m[1][0] = 0.0f; ry.m[1][1] = 1.0f; ry.m[1][2] = 0.0f; ry.m[1][3] = 0.0f;
  ry.m[2][0] = sinf(y); ry.m[2][1] = 0.0f; ry.m[2][2] = cosf(y); ry.m[2][3] = 0.0f;
  ry.m[3][0] = 0.0f; ry.m[3][1] = 0.0f; ry.m[3][2] = 0.0f; ry.m[3][3] = 1.0f;

  rz.m[0][0] = cosf(z); rz.m[0][1] = -sinf(z); rz.m[0][2] = 0.0f; rz.m[0][3] = 0.0f;
  rz.m[1][0] = sinf(z); rz.m[1][1] = cosf(z); rz.m[1][2] = 0.0f; rz.m[1][3] = 0.0f;
  rz.m[2][0] = 0.0f; rz.m[2][1] = 0.0f; rz.m[2][2] = 1.0f; rz.m[2][3] = 0.0f;
  rz.m[3][0] = 0.0f; rz.m[3][1] = 0.0f; rz.m[3][2] = 0.0f; rz.m[3][3] = 1.0f;

  *this = rz * ry * rx;
}

Okay, he wrote what he needs. but it just requires an expression, and which one is not clear. M_PI is declared, so it is dropped. It also gives a syntax error when compiling: "=". I don't understand what to do. Help

Answer the question

In order to leave comments, you need to log in

2 answer(s)
J
jcmvbkbc, 2018-02-21
@jcmvbkbc

M_PI is declared, so it is dropped.

But for the purity of the experiment, still replace ToRadian with this and see if it disappears or does not disappear:
On what line swears?

A
Alexey Gordienko, 2018-02-22
@RdSpclL

You don't have a function, you have a macro.
And please attach the text of the error - it will help.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question