1 | initial version |
Here is the code to apply a shear transformation (https://en.wikipedia.org/wiki/Shear_matrix):
double shear = 3;
vector_3 vertex0(-0.5, 0.5, 0); // v0 v3
vector_3 vertex1(-0.5, -0.5, 0); //
vector_3 vertex2( 0.5, -0.5, 0); //
vector_3 vertex3( 0.5, 0.5, 0); // v1 v2
vertex0.x = vertex0.x + shear*vertex0.y;
vertex1.x = vertex1.x + shear*vertex1.y;
vertex2.x = vertex2.x + shear*vertex2.y;
vertex3.x = vertex3.x + shear*vertex3.y;
double width = vertex3.x - vertex1.x;
cout << width << endl;
2 | No.2 Revision |
Here is the code to apply a shear transformation (https://en.wikipedia.org/wiki/Shear_matrix):
double shear = 3;
vector_3 vertex0(-0.5, 0.5, 0); // v0 v3
vector_3 vertex1(-0.5, -0.5, 0); //
vector_3 vertex2( 0.5, -0.5, 0); //
vector_3 vertex3( 0.5, 0.5, 0); // v1 v2
vertex0.x = vertex0.x + shear*vertex0.y;
vertex1.x = vertex1.x + shear*vertex1.y;
vertex2.x = vertex2.x + shear*vertex2.y;
vertex3.x = vertex3.x + shear*vertex3.y;
double width = vertex3.x - vertex1.x;
cout << width << endl;
endl; // 4
3 | No.3 Revision |
Here is the code to apply a shear transformation (https://en.wikipedia.org/wiki/Shear_matrix):
double shear = 3;
vector_3 vertex0(-0.5, 0.5, 0); // v0 v3
vector_3 vertex1(-0.5, -0.5, 0); //
vector_3 vertex2( 0.5, -0.5, 0); //
vector_3 vertex3( 0.5, 0.5, 0); // v1 v2
vertex0.x = vertex0.x + shear*vertex0.y;
vertex1.x = vertex1.x + shear*vertex1.y;
vertex2.x = vertex2.x + shear*vertex2.y;
vertex3.x = vertex3.x + shear*vertex3.y;
double width = vertex3.x - vertex1.x;
cout << width << endl; // 4
4 == shear + 1
4 | No.4 Revision |
Here is the code to apply a shear transformation (https://en.wikipedia.org/wiki/Shear_matrix):
double shear = 3;
vector_3 vertex0(-0.5, 0.5, 0); // v0 v3
vector_3 vertex1(-0.5, -0.5, 0); //
vector_3 vertex2( 0.5, -0.5, 0); //
vector_3 vertex3( 0.5, 0.5, 0); // v1 v2
vertex0.x = vertex0.x + shear*vertex0.y;
vertex1.x = vertex1.x + shear*vertex1.y;
vertex2.x = vertex2.x + shear*vertex2.y;
vertex3.x = vertex3.x + shear*vertex3.y;
double width = vertex3.x - vertex1.x;
cout << width << endl; // 4 == shear + 1
width == 3 + 1 == 4
5 | No.5 Revision |
Here is the code to apply a shear transformation (https://en.wikipedia.org/wiki/Shear_matrix):
double shear = 3;
vector_3 vertex0(-0.5, 0.5, 0); // v0 v3
vector_3 vertex1(-0.5, -0.5, 0); //
vector_3 vertex2( 0.5, -0.5, 0); //
vector_3 vertex3( 0.5, 0.5, 0); // v1 v2
vertex0.x = vertex0.x + shear*vertex0.y;
vertex1.x = vertex1.x + shear*vertex1.y;
vertex2.x = vertex2.x + shear*vertex2.y;
vertex3.x = vertex3.x + shear*vertex3.y;
double width = vertex3.x - vertex1.x;
cout << width << endl; // shear + width == 3 + 1 == 4
endl;
6 | No.6 Revision |
Here is the code to apply a shear transformation (https://en.wikipedia.org/wiki/Shear_matrix):
double shear = 3;
vector_3 vertex0(-0.5, 0.5, 0); // v0 v3
vector_3 vertex1(-0.5, -0.5, 0); //
vector_3 vertex2( 0.5, -0.5, 0); //
vector_3 vertex3( 0.5, 0.5, 0); // v1 v2
vertex0.x = vertex0.x + shear*vertex0.y;
vertex1.x = vertex1.x + shear*vertex1.y;
vertex2.x = vertex2.x + shear*vertex2.y;
vertex3.x = vertex3.x + shear*vertex3.y;
double width = vertex3.x - vertex1.x;
// when using a unit square, like we do here,
// width == shear + 1
cout << width << endl;
7 | No.7 Revision |
Here is the code to apply a shear transformation (https://en.wikipedia.org/wiki/Shear_matrix):
double shear = 3;
vector_3 vertex0(-0.5, 0.5, 0); // v0 v3
vector_3 vertex1(-0.5, -0.5, 0); //
vector_3 vertex2( 0.5, -0.5, 0); //
vector_3 vertex3( 0.5, 0.5, 0); // v1 v2
vertex0.x = vertex0.x + shear*vertex0.y;
vertex1.x = vertex1.x + shear*vertex1.y;
vertex2.x = vertex2.x + shear*vertex2.y;
vertex3.x = vertex3.x + shear*vertex3.y;
double width = vertex3.x - vertex1.x;
// when using a unit square, square,
// like we do here,
// width == shear + 1
cout << width << endl;
8 | No.8 Revision |
Here is the code to apply a shear transformation (https://en.wikipedia.org/wiki/Shear_matrix):
double shear = 3;
-3;
vector_3 vertex0(-0.5, 0.5, 0); // v0 v3
vector_3 vertex1(-0.5, -0.5, 0); //
vector_3 vertex2( 0.5, -0.5, 0); //
vector_3 vertex3( 0.5, 0.5, 0); // v1 v2
vertex0.x = vertex0.x + shear*vertex0.y;
vertex1.x = vertex1.x + shear*vertex1.y;
vertex2.x = vertex2.x + shear*vertex2.y;
vertex3.x = vertex3.x + shear*vertex3.y;
double width = 0;
if(shear < 0)
width = vertex2.x - vertex0.x;
else
width = vertex3.x - vertex1.x;
// when using a unit square,
// like we do here,
// width == shear abs(shear) + 1
cout << width << endl;