Skip to content

C-API: Add set/get origin, xyz2enh and enh2xyz functions#136

Open
CarawaySeed42 wants to merge 16 commits into
masterfrom
c-api-add-set-origin-feature
Open

C-API: Add set/get origin, xyz2enh and enh2xyz functions#136
CarawaySeed42 wants to merge 16 commits into
masterfrom
c-api-add-set-origin-feature

Conversation

@CarawaySeed42

@CarawaySeed42 CarawaySeed42 commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

When using multiple CRGs or in conjuction with other external data (e.g. OpenDRIVE maps) it is helpful to be able to evaluate in the same coordinate system.
With this PR the ability to set the global coordinate system origin is added.
Additionally one can transform local crg coordinates to global coordinates analog to existing Matlab API functionality.

RESOLVES: #78

Additive inverse of translation and rotation by modifiers should be applied
to channel offsets to retain the global position.
This is also necessary to get closer to parity with the Matlab API crg_mods
function.

Signed-off-by: Patrick Kuemmerle <patrick.kuemmerle@3d-mapping.de>
Signed-off-by: Patrick Kuemmerle <patrick.kuemmerle@3d-mapping.de>
A function to change the global origin was added to the api.
Because multiple functions now manipulate the Z channel,
this functionality got its designated local function

Signed-off-by: Patrick Kuemmerle <patrick.kuemmerle@3d-mapping.de>
Since the heading angle offset is part of the global
coordinate system definition, it should also be changable.

Signed-off-by: Patrick Kuemmerle <patrick.kuemmerle@3d-mapping.de>
Using the public header, a user has no access to
the offset values. Thus a getter function is needed.
To further make use of the global offset values,
the xyz2enh and enh2xyz evaluation functions have
been translated from the Matlab-API. Now a user can
transform between the coordinate systems of different CRG data
or simply just get the global coordinates.
Previously offsetting the elevation had three cases:
Full refline elevation profile, constant elevation and Z-channel only.
When no refline was present, an offset was applied by changing
the z-channel mean value. This is confusing and unneccesary, so now all
elevation offsets are applied by offsetting the refline. This is also how the
Matlab API does offsets.
Also, Z-channel first and last values were never used, which made it even more
confusing.

Signed-off-by: Patrick Kuemmerle <patrick.kuemmerle@3d-mapping.de>
@CarawaySeed42 CarawaySeed42 added the isState:InProgress An issue that is assigned a responsible, has a due date and clear requirements label Jun 11, 2026
Signed-off-by: Patrick Kuemmerle <patrick.kuemmerle@3d-mapping.de>
@CarawaySeed42 CarawaySeed42 added isState:ReadyforCCBreview CCB will review it and change the status to ReadyForMerge if everything is ok and removed isState:InProgress An issue that is assigned a responsible, has a due date and clear requirements labels Jun 14, 2026
CarawaySeed42 and others added 2 commits June 14, 2026 06:19
Precalculate sinus and cosinus of phi offset to accelerate
transformation from and to global coordinates.
Also adjust spacing to match the existing codebase.

Signed-off-by: Patrick Kuemmerle <patrick.kuemmerle@3d-mapping.de>
Removed the unneccessary branch in the offset z channel function
because the first and last values are now always modified.

Signed-off-by: Patrick Kuemmerle <patrick.kuemmerle@3d-mapping.de>
@ClemensLinnhoff

Copy link
Copy Markdown
Collaborator

CCB discussion: Add test case for the new feature

The C-API operates a little differently when
it comes to rotating around the modifier refpoint
compared to Matlab.
This was adapted here and the channel offset Z
function was manually merged from 431a950.

Signed-off-by: Patrick Kuemmerle <patrick.kuemmerle@3d-mapping.de>
…rigin-feature

Merge latest fixes of the additive inverse offset modifications.

Signed-off-by: Patrick Kuemmerle <patrick.kuemmer@3d-mapping.de>
@CarawaySeed42 CarawaySeed42 added isState:InProgress An issue that is assigned a responsible, has a due date and clear requirements and removed isState:ReadyforCCBreview CCB will review it and change the status to ReadyForMerge if everything is ok labels Jul 1, 2026
The latest merge had to change how the additive inverse
offset is calculated and removed the offset change from
the channel offset function. The result is that the origin setter
had to be adapted.

Signed-off-by: Patrick Kuemmerle <patrick.kuemmer@3d-mapping.de>
@CarawaySeed42 CarawaySeed42 added isState:ReadyforCCBreview CCB will review it and change the status to ReadyForMerge if everything is ok and removed isState:InProgress An issue that is assigned a responsible, has a due date and clear requirements labels Jul 1, 2026
Signed-off-by: Patrick Kuemmerle <patrick.kuemmer@3d-mapping.de>
Rename the function from using the term "change"
to "set" for consistency reasons. The term "change"
was used to signify that the origin is not only set but modifications
are taking place in the background.

Signed-off-by: Patrick Kuemmerle <patrick.kuemmer@3d-mapping.de>
Remove the dataset id argument variant and only leave contact point
variant. This variant existed because a contact point is not needed for
this calculation. But forcing the use of a contact point makes it more consistent
for users.

Signed-off-by: Patrick Kuemmerle <patrick.kuemmer@3d-mapping.de>
@asadekasam asadekasam added this to the v2.1.0 milestone Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

isState:ReadyforCCBreview CCB will review it and change the status to ReadyForMerge if everything is ok

Projects

None yet

Development

Successfully merging this pull request may close these issues.

C-API: Add relative offset change

3 participants