Keep "astyled" elements in vector_3.*
This commit is contained in:
@@ -51,9 +51,9 @@ void vector_3::normalize() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void vector_3::apply_rotation(matrix_3x3 matrix) {
|
void vector_3::apply_rotation(matrix_3x3 matrix) {
|
||||||
float resultX = x * matrix.matrix[3*0+0] + y * matrix.matrix[3*1+0] + z * matrix.matrix[3*2+0];
|
float resultX = x * matrix.matrix[3 * 0 + 0] + y * matrix.matrix[3 * 1 + 0] + z * matrix.matrix[3 * 2 + 0];
|
||||||
float resultY = x * matrix.matrix[3*0+1] + y * matrix.matrix[3*1+1] + z * matrix.matrix[3*2+1];
|
float resultY = x * matrix.matrix[3 * 0 + 1] + y * matrix.matrix[3 * 1 + 1] + z * matrix.matrix[3 * 2 + 1];
|
||||||
float resultZ = x * matrix.matrix[3*0+2] + y * matrix.matrix[3*1+2] + z * matrix.matrix[3*2+2];
|
float resultZ = x * matrix.matrix[3 * 0 + 2] + y * matrix.matrix[3 * 1 + 2] + z * matrix.matrix[3 * 2 + 2];
|
||||||
x = resultX;
|
x = resultX;
|
||||||
y = resultY;
|
y = resultY;
|
||||||
z = resultZ;
|
z = resultZ;
|
||||||
@@ -70,7 +70,7 @@ void vector_3::debug(const char title[]) {
|
|||||||
SERIAL_EOL;
|
SERIAL_EOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void apply_rotation_xyz(matrix_3x3 matrix, float &x, float& y, float& z) {
|
void apply_rotation_xyz(matrix_3x3 matrix, float& x, float& y, float& z) {
|
||||||
vector_3 vector = vector_3(x, y, z);
|
vector_3 vector = vector_3(x, y, z);
|
||||||
vector.apply_rotation(matrix);
|
vector.apply_rotation(matrix);
|
||||||
x = vector.x;
|
x = vector.x;
|
||||||
@@ -98,7 +98,7 @@ void matrix_3x3::set_to_identity() {
|
|||||||
|
|
||||||
matrix_3x3 matrix_3x3::create_look_at(vector_3 target) {
|
matrix_3x3 matrix_3x3::create_look_at(vector_3 target) {
|
||||||
vector_3 z_row = target.get_normal();
|
vector_3 z_row = target.get_normal();
|
||||||
vector_3 x_row = vector_3(1, 0, -target.x/target.z).get_normal();
|
vector_3 x_row = vector_3(1, 0, -target.x / target.z).get_normal();
|
||||||
vector_3 y_row = vector_3::cross(z_row, x_row).get_normal();
|
vector_3 y_row = vector_3::cross(z_row, x_row).get_normal();
|
||||||
|
|
||||||
// x_row.debug("x_row");
|
// x_row.debug("x_row");
|
||||||
@@ -123,8 +123,8 @@ matrix_3x3 matrix_3x3::transpose(matrix_3x3 original) {
|
|||||||
void matrix_3x3::debug(const char title[]) {
|
void matrix_3x3::debug(const char title[]) {
|
||||||
SERIAL_PROTOCOLLN(title);
|
SERIAL_PROTOCOLLN(title);
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for(int i=0; i<3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
for(int j=0; j<3; j++) {
|
for (int j = 0; j < 3; j++) {
|
||||||
if (matrix[count] >= 0.0) SERIAL_PROTOCOLCHAR('+');
|
if (matrix[count] >= 0.0) SERIAL_PROTOCOLCHAR('+');
|
||||||
SERIAL_PROTOCOL_F(matrix[count], 6);
|
SERIAL_PROTOCOL_F(matrix[count], 6);
|
||||||
SERIAL_PROTOCOLCHAR(' ');
|
SERIAL_PROTOCOLCHAR(' ');
|
||||||
|
@@ -22,8 +22,7 @@
|
|||||||
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
|
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
|
||||||
class matrix_3x3;
|
class matrix_3x3;
|
||||||
|
|
||||||
struct vector_3
|
struct vector_3 {
|
||||||
{
|
|
||||||
float x, y, z;
|
float x, y, z;
|
||||||
|
|
||||||
vector_3();
|
vector_3();
|
||||||
@@ -42,8 +41,7 @@ struct vector_3
|
|||||||
void apply_rotation(matrix_3x3 matrix);
|
void apply_rotation(matrix_3x3 matrix);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct matrix_3x3
|
struct matrix_3x3 {
|
||||||
{
|
|
||||||
float matrix[9];
|
float matrix[9];
|
||||||
|
|
||||||
static matrix_3x3 create_from_rows(vector_3 row_0, vector_3 row_1, vector_3 row_2);
|
static matrix_3x3 create_from_rows(vector_3 row_0, vector_3 row_1, vector_3 row_2);
|
||||||
@@ -56,7 +54,7 @@ struct matrix_3x3
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void apply_rotation_xyz(matrix_3x3 rotationMatrix, float &x, float& y, float& z);
|
void apply_rotation_xyz(matrix_3x3 rotationMatrix, float& x, float& y, float& z);
|
||||||
#endif // AUTO_BED_LEVELING_FEATURE
|
#endif // AUTO_BED_LEVELING_FEATURE
|
||||||
|
|
||||||
#endif // VECTOR_3_H
|
#endif // VECTOR_3_H
|
||||||
|
Reference in New Issue
Block a user