commit 39c5d858ce06638f288f99261f04e153c082eff3
parent 0eadf0f2c4a207253b895b74463057945d78043b
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Fri, 23 Apr 2021 17:24:39 +0200
Fix the htrdr_combustion_laser_get_mesh function
The output mesh was defined in local laser space, not in world space
Diffstat:
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/combustion/htrdr_combustion_laser.c b/src/combustion/htrdr_combustion_laser.c
@@ -188,6 +188,7 @@ htrdr_combustion_laser_get_mesh
double transform[12];
double low[3];
double upp[3];
+ int i;
ASSERT(laser && extend > 0 && mesh);
htrdr_rectangle_get_transform(laser->surface, transform);
@@ -200,7 +201,7 @@ htrdr_combustion_laser_get_mesh
upp[1] = laser->upp_ls[1];
upp[2] = laser->low_ls[2] + extend;
- /* Transform the laser sheet vertices in world space */
+ /* Define the mesh of the laser sheet in local space */
d3(mesh->vertices + 0*3, low[0], low[1], low[2]);
d3(mesh->vertices + 1*3, upp[0], low[1], low[2]);
d3(mesh->vertices + 2*3, low[0], upp[1], low[2]);
@@ -211,6 +212,13 @@ htrdr_combustion_laser_get_mesh
d3(mesh->vertices + 7*3, upp[0], upp[1], upp[2]);
mesh->nvertices = 8;
+ /* Transform the laser sheet vertices in world space */
+ FOR_EACH(i, 0, 8) {
+ double* v = mesh->vertices + i*3;
+ d33_muld3(v, transform, v);
+ d3_add(v, v, transform+9);
+ }
+
/* Define the laser sheet triangles */
mesh->triangles[0] = 0; mesh->triangles[1] = 2; mesh->triangles[2] = 1;
mesh->triangles[3] = 1; mesh->triangles[4] = 2; mesh->triangles[5] = 3;