commit ddb598c67d6e6cbde0661993f0303bcea799d64f
parent 27050cad67242fc96c93915947b4718a57ad652f
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Thu, 12 Jan 2017 16:13:24 +0100
Convert the parsed rotation in radian
Diffstat:
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/parser/solparser.c b/src/parser/solparser.c
@@ -558,6 +558,11 @@ parse_transform
} else if(!strcmp((char*)key->data.scalar.value, "rotation")) {
SETUP_MASK(ROTATION, "rotation");
res = parse_real3(parser, doc, val, -DBL_MAX, DBL_MAX, rotation);
+ if(res == RES_OK) {
+ rotation[0] = MDEG2RAD(rotation[0]);
+ rotation[1] = MDEG2RAD(rotation[1]);
+ rotation[2] = MDEG2RAD(rotation[2]);
+ }
} else {
log_err(parser, key, "unknown transform parameter `%s'.\n",
key->data.scalar.value);
diff --git a/src/parser/test_solparser2.c b/src/parser/test_solparser2.c
@@ -166,7 +166,9 @@ main(int argc, char** argv)
entity_id = solparser_entity_get_child(entity, 1);
entity1b = solparser_get_entity(parser, entity_id);
CHECK(d3_eq(entity1b->translation, d3_splat(tmp, 0)), 1);
- CHECK(d3_eq(entity1b->rotation, d3(tmp, 3.14, 0, -1)), 1);
+ tmp[0] = MDEG2RAD(3.14);
+ tmp[2] = MDEG2RAD(-1);
+ CHECK(d3_eq_eps(entity1b->rotation, tmp, 1.e-6), 1);
CHECK(strcmp("lvl1b", str_cget(&entity1b->name)), 0);
CHECK(solparser_entity_get_children_count(entity1b), 1);
CHECK(entity1b->type, SOLPARSER_ENTITY_GEOMETRY);