diff --git a/pybricks/geometry.h b/pybricks/geometry.h index dfd6c486b..62e14155b 100644 --- a/pybricks/geometry.h +++ b/pybricks/geometry.h @@ -28,6 +28,7 @@ typedef struct _pb_type_Matrix_obj_t { const pb_type_Matrix_obj_t pb_Axis_X_obj; const pb_type_Matrix_obj_t pb_Axis_Y_obj; const pb_type_Matrix_obj_t pb_Axis_Z_obj; +const pb_type_Matrix_obj_t pb_Matrix_identity3_obj; mp_obj_t pb_type_Matrix_make_vector(size_t m, float *data, bool normalize); diff --git a/pybricks/geometry/pb_module_geometry.c b/pybricks/geometry/pb_module_geometry.c index 20410656b..31438c742 100644 --- a/pybricks/geometry/pb_module_geometry.c +++ b/pybricks/geometry/pb_module_geometry.c @@ -45,6 +45,20 @@ const pb_type_Matrix_obj_t pb_Axis_Z_obj = { .n = 1, }; +STATIC const float pb_Matrix_identity3_data[] = { + 1.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, + 0.0f, 0.0f, 1.0f, +}; + +const pb_type_Matrix_obj_t pb_Matrix_identity3_obj = { + {&pb_type_Matrix}, + .data = (float *)pb_Matrix_identity3_data, + .scale = 1.0f, + .m = 3, + .n = 3, +}; + STATIC const mp_rom_map_elem_t pb_Axis_table[] = { { MP_ROM_QSTR(MP_QSTR_X), MP_ROM_PTR(&pb_Axis_X_obj)}, { MP_ROM_QSTR(MP_QSTR_Y), MP_ROM_PTR(&pb_Axis_Y_obj)},