Skip to content
Snippets Groups Projects
Commit 4e47db48 authored by Jean Patrick Mathes's avatar Jean Patrick Mathes
Browse files

Fix volume calculation of paths and lines

parent 2886504a
No related branches found
No related tags found
2 merge requests!77Upcoming Release,!42Resolve "viz::Path and viz::Line are only drawn as single pixel line, i.e. do not consider with / lineWidth parameter"
......@@ -113,11 +113,11 @@ avi::scene::LineElementNode::newLineElementNode(std::string name, avi::core::Lay
godot::AABB
avi::scene::LineElementNode::getVolume()
{
godot::AABB aabb(a, godot::Vector3::ZERO);
aabb.expand_to(b);
godot::AABB aabb(a / avi::core::GODOT_TO_ARMARX_CONVERSION_FACTOR, godot::Vector3::ZERO);
aabb.expand_to(b / avi::core::GODOT_TO_ARMARX_CONVERSION_FACTOR);
aabb.position += staticBody->get_transform().origin;
aabb.size *= staticBody->get_scale() * 0.5;
aabb.size *= staticBody->get_scale() * 0.5 * avi::core::GODOT_TO_ARMARX_CONVERSION_FACTOR;
return aabb;
}
......@@ -186,13 +186,13 @@ avi::scene::LineElementNode::updateLine(godot::Vector3 from, godot::Vector3 to)
void
avi::scene::LineElementNode::setPosition(godot::Vector3 position)
{
this->set_translation(position);
staticBody->set_translation(position);
}
void
avi::scene::LineElementNode::setRotation(godot::Quat rotation)
{
this->set_rotation(rotation.get_euler());
staticBody->set_rotation(rotation.get_euler());
}
void
......
......@@ -128,10 +128,10 @@ avi::scene::PathElementNode::updateAttributes(int flag,
godot::AABB
avi::scene::PathElementNode::getVolume()
{
godot::Vector3 position = minPoint;
godot::Vector3 position = minPoint / avi::core::GODOT_TO_ARMARX_CONVERSION_FACTOR;
godot::Vector3 size = maxPoint - minPoint;
godot::AABB aabb(position / avi::core::GODOT_TO_ARMARX_CONVERSION_FACTOR, size);
godot::AABB aabb(position, size);
aabb.position += staticBody->get_transform().origin;
aabb.size *= staticBody->get_scale() * 0.5;
......@@ -280,19 +280,19 @@ avi::scene::PathElementNode::buildSpheres()
void
avi::scene::PathElementNode::setPosition(godot::Vector3 position)
{
this->set_translation(position);
staticBody->set_translation(position);
}
void
avi::scene::PathElementNode::setRotation(godot::Quat rotation)
{
this->set_rotation(rotation.get_euler());
staticBody->set_rotation(rotation.get_euler());
}
void
avi::scene::PathElementNode::setScale(godot::Vector3 scale)
{
this->set_scale(scale);
staticBody->set_scale(scale);
}
void
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment