Jump to content

get HAT/HOT


photo

Recommended Posts

image.png.54fa3a02773ec111eef043767fe1aab9.png 

When calculating the HAT/HOT value directly by code,
Is it correct to write like the following code?
The test result is a little different. ( Code Result and HEMU Result) 

 

float angle = AppSystemLogic::ig_manager->findEntity(node)->getRotationEuler().z;

Mat4 angleTransform = translate(node->getWorldPosition())* (Mat4)rotateZ(-angle);

Vec3 pos0 = angleTransform * Vec3(2,1,-3);

 

bool b0 = AppSystemLogic::ig_manager->getHatHot(AppSystemLogic::ig_manager->getConverter()->worldToGeodetic(pos0), 
        vec3(), hat0, hot0, MatCode0);

Edited by dongju.jeong
Link to comment

Hello!
its sample how to call hat/hot

Vec3 offset = Vec3(1,2,3);

int entity_id = 1;
auto entity = ig_manager->getEntity(1);
// auto entity = ig_manager->findEntity(node); 
// if (entity) ...

Vec3 geo_position = ig_manager->getConverter()->worldToGeodetic(entity->getNode()->getWorldTransform() * convert->NEDtoENU(offset));

double hat = 0, hot = 0;
Unigine::Plugins::IG::IGIntersection intersection;
if (ig_manager->getHatHot(geo_position, hat, hot, intersection))
{
// do smth
}
  • Like 1
Link to comment

Thank you.

However, if worldtransform is used as it is, the HAT/HOT result value is affected by roll and pitch.

 

Is this code wrong?

Mat4 angleTransform = translate(node->getWorldPosition())* (Mat4)rotateZ(-angle);

 

Edited by dongju.jeong
Link to comment
5 hours ago, dongju.jeong said:

image.png.54fa3a02773ec111eef043767fe1aab9.png 

When calculating the HAT/HOT value directly by code,
Is it correct to write like the following code?
The test result is a little different. ( Code Result and HEMU Result) 

 

2 hours ago, dongju.jeong said:

However, if worldtransform is used as it is, the HAT/HOT result value is affected by roll and pitch.

according CIGI_ICD reference point must be in Entity Coodrinate system. that is why you have a difference in results.

2 hours ago, dongju.jeong said:

Is this code wrong?

Mat4 angleTransform = translate(node->getWorldPosition())* (Mat4)rotateZ(-angle);

if you want calculate HAT/HOT witout affected by roll and pitch - yes, this code is right. but this may not match the result of the cigi hat/hot.

I recommend using a visualizer to understand how raycast happens.

Visualizer::renderPoint3D(pos0, 0.25, vec4::BLUE);
Visualizer::renderLine3D(pos0 + Vec3::UP * 1000, pos0 - Vec3::UP * 1000, vec4::GREEN)

 

Link to comment
×
×
  • Create New...