Commit 1529871f authored by Stefan Pfeifer's avatar Stefan Pfeifer

Merge branch 'limb-view-navigation' into develop

parents 2b590469 41c128f2
......@@ -151,6 +151,10 @@ add_library(
source/gui/input/editors/TreeEditor.cpp
source/gui/input/editors/TreeEditor.hpp
source/gui/input/editors/TreeItem.hpp
source/gui/input/views/AABB.cpp
source/gui/input/views/AABB.hpp
source/gui/input/views/LayerLegend.cpp
source/gui/input/views/LayerLegend.hpp
source/gui/input/views/LimbView.cpp
source/gui/input/views/LimbView.hpp
source/gui/input/views/LimbMesh.cpp
......
resources/icons/limb-view/view-fit.png

738 Bytes | W: | H:

resources/icons/limb-view/view-fit.png

376 Bytes | W: | H:

resources/icons/limb-view/view-fit.png
resources/icons/limb-view/view-fit.png
resources/icons/limb-view/view-fit.png
resources/icons/limb-view/view-fit.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -14,9 +14,9 @@
viewBox="0 0 55.35762 55.357621"
id="svg2"
version="1.1"
inkscape:version="0.91 r13725"
inkscape:version="0.92.3 (2405546, 2018-03-11)"
sodipodi:docname="view-fit.svg"
inkscape:export-filename="/mnt/Daten/Projekte/Bow-Simulator/Repositories/bow-simulator/resources/icons/view-fit.png"
inkscape:export-filename="/home/stefan/Desktop/Repositories/bow-simulator/resources/icons/limb-view/view-fit.png"
inkscape:export-xdpi="78.03804"
inkscape:export-ydpi="78.03804">
<defs
......@@ -44,21 +44,25 @@
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="7.9195959"
inkscape:cx="22.172211"
inkscape:cy="19.503179"
inkscape:zoom="11.2"
inkscape:cx="21.628694"
inkscape:cy="29.253121"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
showgrid="true"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:window-width="1920"
inkscape:window-height="1013"
inkscape:window-height="1001"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1" />
inkscape:window-maximized="1">
<inkscape:grid
type="xygrid"
id="grid3724" />
</sodipodi:namedview>
<metadata
id="metadata7">
<rdf:RDF>
......@@ -67,7 +71,7 @@
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
......@@ -76,65 +80,29 @@
inkscape:groupmode="layer"
id="layer1"
transform="translate(-64.697271,-815.73534)">
<g
id="g4616"
transform="translate(14.000001,14.000001)">
<path
inkscape:connector-curvature="0"
id="path4136"
d="M 70.048421,821.10885 58.466254,809.52668"
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:5.00000048;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
sodipodi:nodetypes="cccc"
inkscape:connector-curvature="0"
id="path4596"
d="m 57.289024,808.29299 0,11.42632 11.277276,-11.40148 z"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.11282372px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
</g>
<g
transform="matrix(0,1,-1,0,921.71879,765.06247)"
id="g4616-7">
<path
inkscape:connector-curvature="0"
id="path4136-5"
d="M 70.048421,821.10885 58.466254,809.52668"
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:5.00000048;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
sodipodi:nodetypes="cccc"
inkscape:connector-curvature="0"
id="path4596-3"
d="m 57.289024,808.29299 0,11.42632 11.277276,-11.40148 z"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.11282372px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
</g>
<g
transform="matrix(0,-1,1,0,-737.03808,921.79145)"
id="g4616-5">
<path
inkscape:connector-curvature="0"
id="path4136-6"
d="M 70.048421,821.10885 58.466254,809.52668"
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:5.00000048;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
sodipodi:nodetypes="cccc"
inkscape:connector-curvature="0"
id="path4596-2"
d="m 57.289024,808.29299 0,11.42632 11.277276,-11.40148 z"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.11282372px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
</g>
<g
transform="matrix(-1,0,0,-1,170.73665,1672.8236)"
id="g4616-9">
<path
inkscape:connector-curvature="0"
id="path4136-1"
d="M 70.048421,821.10885 58.466254,809.52668"
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:5.00000048;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
sodipodi:nodetypes="cccc"
inkscape:connector-curvature="0"
id="path4596-27"
d="m 57.289024,808.29299 0,11.42632 11.277276,-11.40148 z"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.11282372px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
</g>
<path
style="fill:none;stroke:#000000;stroke-width:4.6875;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 75.009771,848.59296 v 10.3125 h 10.312501"
id="path3726"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccc" />
<path
style="fill:none;stroke:#000000;stroke-width:4.68749952;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 85.322271,828.90546 h -10.3125 v 10.3125"
id="path3726-3"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccc" />
<path
style="fill:none;stroke:#000000;stroke-width:4.68749952;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 110.63477,839.21796 v -10.3125 h -10.3125"
id="path3726-3-6"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccc" />
<path
style="fill:none;stroke:#000000;stroke-width:4.68749952;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 100.32227,858.90546 h 10.3125 v -10.3125"
id="path3726-3-7"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccc" />
</g>
</svg>
resources/icons/limb-view/view-symmetric.png

484 Bytes | W: | H:

resources/icons/limb-view/view-symmetric.png

476 Bytes | W: | H:

resources/icons/limb-view/view-symmetric.png
resources/icons/limb-view/view-symmetric.png
resources/icons/limb-view/view-symmetric.png
resources/icons/limb-view/view-symmetric.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -14,9 +14,9 @@
viewBox="0 0 71.773902 71.7739"
id="svg2"
version="1.1"
inkscape:version="0.91 r13725"
inkscape:version="0.92.3 (2405546, 2018-03-11)"
sodipodi:docname="view-symmetric.svg"
inkscape:export-filename="/mnt/Daten/Projekte/Bow-Simulator/Repositories/bow-simulator/resources/icons/view-symmetric.png"
inkscape:export-filename="/home/stefan/Desktop/Repositories/bow-simulator/resources/icons/limb-view/view-symmetric.png"
inkscape:export-xdpi="60.189007"
inkscape:export-ydpi="60.189007">
<defs
......@@ -28,21 +28,25 @@
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="5.6"
inkscape:cx="33.635362"
inkscape:cy="33.403729"
inkscape:zoom="11.2"
inkscape:cx="39.541315"
inkscape:cy="39.629024"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
showgrid="true"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:window-width="1920"
inkscape:window-height="1013"
inkscape:window-height="1001"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1" />
inkscape:window-maximized="1">
<inkscape:grid
type="xygrid"
id="grid843" />
</sodipodi:namedview>
<metadata
id="metadata7">
<rdf:RDF>
......@@ -62,13 +66,7 @@
transform="translate(-56.604637,-807.62746)">
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 92.465052,808.96353 0,12.78474"
id="path4151"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 92.489835,826.83716 0,5.30577"
d="m 92.229639,828.77636 v 5.30577"
id="path4153"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
......@@ -86,20 +84,26 @@
sodipodi:nodetypes="cccc" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 92.414309,854.65466 0,5.30577"
d="m 92.229639,853.15136 v 5.30577"
id="path4153-6"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 92.465051,836.76977 0,12.78474"
d="m 92.229639,837.71679 v 11.48259"
id="path4151-6"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 92.338783,865.30658 0,12.78474"
id="path4151-6-1"
d="m 92.229639,814.71386 0,10.3125"
id="path4151-6-3"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 92.229639,861.58886 0,10.3125"
id="path4151-6-6"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
</g>
......
#pragma once
#include <QVector3D>
class AABB
{
public:
AABB(): AABB(max_inf(), min_inf())
{
}
AABB(const QVector3D& vec_min, const QVector3D& vec_max)
: vec_min(vec_min), vec_max(vec_max)
{
}
AABB extend(const AABB& other) const
{
return {
min(vec_min, other.vec_min),
max(vec_max, other.vec_max)
};
}
AABB extend(const QVector3D& point) const
{
return {
min(vec_min, point),
max(vec_max, point)
};
}
QVector3D center() const
{
return (vec_min + vec_max)/2.0f;
}
float diagonal() const
{
return (vec_max - vec_min).length();
}
private:
QVector3D vec_min;
QVector3D vec_max;
QVector3D min(const QVector3D& vec1, const QVector3D& vec2) const
{
return {
std::min(vec1.x(), vec2.x()),
std::min(vec1.y(), vec2.y()),
std::min(vec1.z(), vec2.z())
};
}
QVector3D max(const QVector3D& vec1, const QVector3D& vec2) const
{
return {
std::max(vec1.x(), vec2.x()),
std::max(vec1.y(), vec2.y()),
std::max(vec1.z(), vec2.z())
};
}
QVector3D min_inf() const
{
return {
-std::numeric_limits<float>::infinity(),
-std::numeric_limits<float>::infinity(),
-std::numeric_limits<float>::infinity()
};
}
QVector3D max_inf() const
{
return {
std::numeric_limits<float>::infinity(),
std::numeric_limits<float>::infinity(),
std::numeric_limits<float>::infinity()
};
}
};
......@@ -12,64 +12,23 @@ QColor getLayerColor(const Layer& layer)
return QColor::fromHsvF(uni(rng), 0.8, 1.0);
}
/*
std::vector<QColor> getLayerColors(const Layers& layers)
{
double h_min = 0.0;
double h_max = 0.2;
double s_min = 0.5;
double s_max = 1.0;
auto cmp_rho = [](const Layer& lhs, const Layer& rhs){ return lhs.rho < rhs.rho; };
auto cmp_E = [](const Layer& lhs, const Layer& rhs){ return lhs.E < rhs.E; };
double rho_min = std::min_element(layers.begin(), layers.end(), cmp_rho)->rho;
double rho_max = std::max_element(layers.begin(), layers.end(), cmp_rho)->rho;
double E_min = std::min_element(layers.begin(), layers.end(), cmp_E)->E;
double E_max = std::max_element(layers.begin(), layers.end(), cmp_E)->E;
std::vector<QColor> colors;
for(auto& layer: layers)
{
double h = (E_min < E_max)
? h_min + (layer.E - E_min)/(E_max - E_min)*(h_max - h_min)
: 0.5*(h_min + h_max);
double s = (rho_min < rho_max)
? s_min + (layer.rho - rho_min)/(rho_max - rho_min)*(s_max - s_min)
: 0.5*(s_min + s_max);
qInfo() << "h = " << h;
qInfo() << "s = " << s;
colors.push_back(QColor::fromHsvF(h, s, 1.0));
}
return colors;
}
*/
QPixmap getLayerPixmap(const Layer& layer)
{
// https://stackoverflow.com/a/29196812/4692009
// https://stackoverflow.com/a/37213313/4692009
const double size = 48.0;
const QColor color = getLayerColor(layer);
const int size = 48;
const int line_width = 2;
const qreal rounding = 0.2;
QPixmap pixmap(size, size);
pixmap.fill(Qt::transparent);
QPainter painter(&pixmap);
painter.setRenderHint(QPainter::Antialiasing);
//painter.setCompositionMode(QPainter::CompositionMode_SourceOver);
painter.fillRect(QRectF{0.0, 0.0, size, size}, color);
//QPainterPath path;
//path.addRoundedRect(QRectF(0, 0, size, size), 0.3*size, 0.3*size);
//painter.setPen(Qt::NoPen);
//painter.fillPath(path, color);
//painter.drawPath(path);
painter.setPen({Qt::black, line_width});
painter.setBrush(getLayerColor(layer));
QPainterPath path;
path.addRoundedRect({line_width/2, line_width/2, size - line_width, size - line_width},
rounding*size, rounding*size);
painter.drawPath(path);
return pixmap;
}
#include "LayerLegend.hpp"
LayerEntry::LayerEntry()
: symbol(new QLabel()),
label(new QLabel())
{
symbol->setFixedWidth(18); // Magic number
symbol->setFixedHeight(18); // Magic number
symbol->setScaledContents(true);
label->setStyleSheet("color: white; font: 18px; max-height: 18px; background-color: transparent;");
auto hbox = new QHBoxLayout();
hbox->setMargin(2); // Magic number
hbox->addWidget(symbol, 0);
hbox->addSpacing(10); // Magic number
hbox->addWidget(label, 1);
this->setLayout(hbox);
}
void LayerEntry::setData(const Layer& layer)
{
symbol->setPixmap(getLayerPixmap(layer));
label->setText(QString::fromStdString(layer.name));
}
LayerLegend::LayerLegend()
: vbox(new QVBoxLayout())
{
this->setLayout(vbox);
}
void LayerLegend::setData(const Layers& layers)
{
while(vbox->count() < layers.size())
vbox->addWidget(new LayerEntry());
while(vbox->count() > layers.size())
{
QWidget* widget = vbox->takeAt(0)->widget();
widget->setParent(nullptr);
widget->deleteLater();
}
for(int i = 0; i < vbox->count(); ++i)
{
LayerEntry* layer = dynamic_cast<LayerEntry*>(vbox->itemAt(i)->widget());
layer->setData(layers[i]);
}
vbox->update();
}
#pragma once
#include "bow/input/Layers.hpp"
#include "LayerColors.hpp"
#include <QtWidgets>
class LayerEntry: public QWidget
{
public:
LayerEntry();
void setData(const Layer& layer);
private:
QLabel* symbol;
QLabel* label;
};
class LayerLegend: public QWidget
{
public:
LayerLegend();
void setData(const Layers& layers);
private:
QVBoxLayout* vbox;
};
......@@ -3,11 +3,18 @@
#include "bow/LimbProperties.hpp"
#include "numerics/ArcCurve.hpp"
#include "numerics/CubicSpline.hpp"
#include <qmath.h>
LimbMesh::LimbMesh(bool inverted)
: visible(true),
inverted(inverted)
{
}
void LimbMesh::setData(const InputData& data)
{
vertex_data.clear();
bounding_box = AABB();
// Todo: Abstract away the conversion data -> profile curve
std::vector<double> lengths = getEvalLengths(data, 100);
......@@ -26,21 +33,21 @@ void LimbMesh::setData(const InputData& data)
size_t n_layers = data.layers.size();
size_t n_sections = lengths.size()-1;
std::vector<Vector<3>> points_l_prev(n_layers+1);
std::vector<Vector<3>> points_l_next(n_layers+1);
std::vector<Vector<3>> points_r_prev(n_layers+1);
std::vector<Vector<3>> points_r_next(n_layers+1);
std::vector<QVector3D> points_l_prev(n_layers+1);
std::vector<QVector3D> points_l_next(n_layers+1);
std::vector<QVector3D> points_r_prev(n_layers+1);
std::vector<QVector3D> points_r_next(n_layers+1);
std::vector<size_t> layer_indices(n_layers);
for(size_t i = 0; i < n_sections; ++i)
{
Vector<3> center_prev {profile.x[i], profile.y[i], 0.0 };
Vector<3> normal_w_prev{ 0.0, 0.0, 1.0 };
Vector<3> normal_h_prev{-sin(profile.phi[i]), cos(profile.phi[i]), 0.0 };
QVector3D center_prev (profile.x[i], profile.y[i], 0.0 );
QVector3D normal_w_prev( 0.0, 0.0, 1.0 );
QVector3D normal_h_prev(-sin(profile.phi[i]), cos(profile.phi[i]), 0.0 );
Vector<3> center_next { profile.x[i+1], profile.y[i+1], 0.0 };
Vector<3> normal_w_next{ 0.0, 0.0, 1.0 };
Vector<3> normal_h_next{-sin(profile.phi[i+1]), cos(profile.phi[i+1]), 0.0 };
QVector3D center_next ( profile.x[i+1], profile.y[i+1], 0.0 );
QVector3D normal_w_next( 0.0, 0.0, 1.0 );
QVector3D normal_h_next(-sin(profile.phi[i+1]), cos(profile.phi[i+1]), 0.0 );
double p_prev = profile.s[i]/profile.s.maxCoeff();
double p_next = profile.s[i+1]/profile.s.maxCoeff();
......@@ -74,8 +81,8 @@ void LimbMesh::setData(const InputData& data)
if(layer_indices.empty())
add_points(h_sum_prev, h_sum_next);
h_sum_prev += h_prev;
h_sum_next += h_next;
h_sum_prev -= h_prev;
h_sum_next -= h_next;
add_points(h_sum_prev, h_sum_next);
layer_indices.push_back(j);
......@@ -86,36 +93,27 @@ void LimbMesh::setData(const InputData& data)
{
QColor color = getLayerColor(data.layers[layer_indices[j]]);
// Top side (back)
if(j == 0)
addQuad(points_l_prev[j], points_r_prev[j], points_r_next[j], points_l_next[j], color);
// Bottom side (belly)
if(j == layer_indices.size() - 1)
addQuad(points_l_prev[j+1], points_l_next[j+1], points_r_next[j+1], points_r_prev[j+1], color);
// Limb start
if(i == 0)
{
addQuad(points_r_next[j], points_l_next[j], points_l_next[j+1], points_r_next[j+1], color);
}
addQuad(points_r_prev[j], points_l_prev[j], points_l_prev[j+1], points_r_prev[j+1], color);
// Limb end
if(i == n_sections - 1)
{
addQuad(points_r_next[j], points_r_next[j+1], points_l_next[j+1], points_l_next[j], color);
}
if(i > 0)
{
// Left
addQuad(points_l_prev[j], points_l_next[j], points_l_next[j+1], points_l_prev[j+1], color);
// Right
addQuad(points_r_prev[j], points_r_prev[j+1], points_r_next[j+1], points_r_next[j], color);
// Top
if(j == 0)
{
addQuad(points_l_prev[j], points_r_prev[j], points_r_next[j], points_l_next[j], color);
}
// Bottom
if(j == layer_indices.size() - 1)
{
addQuad(points_l_prev[j+1], points_l_next[j+1], points_r_next[j+1], points_r_prev[j+1], color);
}
}
// Left side
addQuad(points_l_prev[j], points_l_next[j], points_l_next[j+1], points_l_prev[j+1], color);
// Right side
addQuad(points_r_prev[j], points_r_prev[j+1], points_r_next[j+1], points_r_next[j], color);
}
}
}
......@@ -161,12 +159,36 @@ size_t LimbMesh::vertexCount() const
return vertex_data.size()/9;
}
void LimbMesh::addQuad(const Vector<3>& p0, const Vector<3>& p1, const Vector<3>& p2, const Vector<3>& p3, const QColor& color)
const AABB LimbMesh::aabb() const
{
Vector<3> n0 = (p1 - p0).cross(p3 - p0).normalized();
Vector<3> n1 = (p2 - p1).cross(p0 - p1).normalized();
Vector<3> n2 = (p3 - p2).cross(p1 - p2).normalized();
Vector<3> n3 = (p0 - p3).cross(p2 - p3).normalized();
return bounding_box;
}
bool LimbMesh::isVisible() const
{
return visible;
}
void LimbMesh::setVisible(bool value)
{
visible = value;
}
void LimbMesh::addQuad(QVector3D p0, QVector3D p1, QVector3D p2, QVector3D p3, const QColor& color)
{
if(inverted)
{
p0.setX(-p0.x());
p1.setX(-p1.x());
p2.setX(-p2.x());
p3.setX(-p3.x());
std::swap(p1, p3);
}
QVector3D n0 = QVector3D::normal(p1 - p0, p3 - p0);
QVector3D n1 = QVector3D::normal(p2 - p1, p0 - p1);
QVector3D n2 = QVector3D::normal(p3 - p2, p1 - p2);
QVector3D n3 = QVector3D::normal(p0 - p3, p2 - p3);
addVertex(p0, n0, color);
addVertex(p1, n1, color);
......@@ -177,7 +199,7 @@ void LimbMesh::addQuad(const Vector<3>& p0, const Vector<3>& p1, const Vector<3>
addVertex(p3, n3, color);
}
void LimbMesh::addVertex(const Vector<3>& position, const Vector<3>& normal, const QColor& color)
void LimbMesh::addVertex(const QVector3D& position, const QVector3D& normal, const QColor& color)
{
vertex_data.push_back(position.x());
vertex_data.push_back(position.y());
......@@ -190,4 +212,6 @@ void LimbMesh::addVertex(const Vector<3>& position, const Vector<3>& normal, con
vertex_data.push_back(color.redF());
vertex_data.push_back(color.greenF());
vertex_data.push_back(color.blueF());
bounding_box = bounding_box.extend(position);
}
#pragma once
#include "bow/input/InputData.hpp"
#include "numerics/Eigen.hpp"
#include "AABB.hpp"
#include <qopengl.h>
#include <QVector3D>
#include <QColor>
......@@ -8,16 +9,23 @@
class LimbMesh
{
public:
LimbMesh() = default;
LimbMesh(bool inverted);
void setData(const InputData& data);
const std::vector<GLfloat>& vertexData() const;
size_t vertexCount() const;
const AABB aabb() const;
bool isVisible() const;
void setVisible(bool value);
private:
void addQuad(const Vector<3>& p0, const Vector<3>& p1, const Vector<3>& p2, const Vector<3>& p3, const QColor& color);
void addVertex(const Vector<3>& position, const Vector<3>& normal, const QColor& color);
void addQuad(QVector3D p0, QVector3D p1, QVector3D p2, QVector3D p3, const QColor& color);
void addVertex(const QVector3D& position, const QVector3D& normal, const QColor& color);
std::vector<double> getEvalLengths(const InputData& data, unsigned n);
bool visible;
bool inverted;
std::vector<GLfloat> vertex_data;
AABB bounding_box;
};
This diff is collapsed.
#pragma once
#include "bow/input/InputData.hpp"
#include "LimbMesh.hpp"
#include "LayerLegend.hpp"
#include <QtWidgets>
#include <QOpenGLWidget>
#include <QOpenGLFunctions>