chore: Cleanup cube
This commit is contained in:
parent
ceeeda3e8b
commit
3d600174b3
1 changed files with 10 additions and 23 deletions
33
src/cube.cpp
33
src/cube.cpp
|
@ -11,20 +11,6 @@ void cube(
|
|||
// Construct default Blender cube.
|
||||
|
||||
V.resize(8,3);
|
||||
F.resize(6,4);
|
||||
// for (int i = 0; i < 8; i++) {
|
||||
// V(i,0) = 1 - (i&4) / 2;
|
||||
// V(i,1) = 1 - 2 * (i&1);
|
||||
// V(i,2) = -1 + 1 * (i&2);
|
||||
|
||||
// V.row(i) = Eigen::RowVector3d(1 - (i&4) / 2, 1 - 2 * (i&1), -1 + 1 * (i&2));
|
||||
|
||||
/* Add Vertex to the faces it belongs to */
|
||||
// F(0 + (i&4) / 2, i % 4) = i;
|
||||
// F(1 + 2 * (i&1), i / 2) = i;
|
||||
// F(5 - (i&2) / 2, (i % 4) % 2 + (i / 4) * 2) = i;
|
||||
// }
|
||||
|
||||
V.row(0) = Eigen::RowVector3d( 1, 1, -1);
|
||||
V.row(1) = Eigen::RowVector3d( 1, -1, -1);
|
||||
V.row(2) = Eigen::RowVector3d( 1, 1, 1);
|
||||
|
@ -34,6 +20,7 @@ void cube(
|
|||
V.row(6) = Eigen::RowVector3d(-1, 1, 1);
|
||||
V.row(7) = Eigen::RowVector3d(-1, -1, 1);
|
||||
|
||||
F.resize(6,4);
|
||||
F.row(0) = Eigen::RowVector4i(1, 3, 4, 2);
|
||||
F.row(1) = Eigen::RowVector4i(5, 7, 3, 1);
|
||||
F.row(2) = Eigen::RowVector4i(6, 8, 7, 5);
|
||||
|
@ -56,19 +43,19 @@ void cube(
|
|||
|
||||
UV.resize(14,2);
|
||||
UV.row(0) = Eigen::RowVector2d(0.25, 0);
|
||||
UV.row(1) = Eigen::RowVector2d(0.5, 0);
|
||||
UV.row(1) = Eigen::RowVector2d(0.50, 0);
|
||||
for (int i = 0; i < 5; i++) {
|
||||
UV.row(2 + i) = Eigen::RowVector2d(0.25 * i, 0.25);
|
||||
UV.row(7 + i) = Eigen::RowVector2d(0.25 * i, 0.5);
|
||||
UV.row(7 + i) = Eigen::RowVector2d(0.25 * i, 0.50);
|
||||
}
|
||||
UV.row(12) = Eigen::RowVector2d(0.25, 0.75);
|
||||
UV.row(13) = Eigen::RowVector2d(0.5, 0.75);
|
||||
UV.row(13) = Eigen::RowVector2d(0.50, 0.75);
|
||||
|
||||
UF.resize(6,4);
|
||||
UF.row(0) = Eigen::RowVector4i(4, 5, 10, 9);
|
||||
UF.row(1) = Eigen::RowVector4i(5, 6, 11, 10);
|
||||
UF.row(2) = Eigen::RowVector4i(6, 7, 12, 11);
|
||||
UF.row(3) = Eigen::RowVector4i(3, 4, 9, 8);
|
||||
UF.row(4) = Eigen::RowVector4i(9, 10, 14, 13);
|
||||
UF.row(5) = Eigen::RowVector4i(1, 2, 5, 4);
|
||||
UF.row(0) = Eigen::RowVector4i( 4, 5, 10, 9);
|
||||
UF.row(1) = Eigen::RowVector4i( 5, 6, 11, 10);
|
||||
UF.row(2) = Eigen::RowVector4i( 6, 7, 12, 11);
|
||||
UF.row(3) = Eigen::RowVector4i( 3, 4, 9, 8);
|
||||
UF.row(4) = Eigen::RowVector4i( 9, 10, 14, 13);
|
||||
UF.row(5) = Eigen::RowVector4i( 1, 2, 5, 4);
|
||||
}
|
||||
|
|
Reference in a new issue