31#include <visp3/rbt/vpObjectCentricRenderer.h>
33#include <visp3/core/vpRect.h>
35#include "boundingSphere.h"
36#include "boundingBox.h"
37#include "graphicsOutput.h"
38#include "graphicsEngine.h"
39#include "windowFramework.h"
40#include "load_prc_file.h"
52 if (m_shouldComputeBBPoints) {
54 m_shouldComputeBBPoints =
false;
59 m_bb.setTop(std::max(m_bb.getTop() - delta, 0.0));
60 m_bb.setLeft(std::max(m_bb.getLeft() - delta, 0.0));
61 m_bb.setBottom(std::min(m_bb.getBottom() + delta,
static_cast<double>(
m_renderParameters.getImageHeight() - 1)));
62 m_bb.setRight(std::min(m_bb.getRight() + delta,
static_cast<double>(
m_renderParameters.getImageWidth() - 1)));
67 unsigned width =
static_cast<unsigned int>(m_bb.getWidth());
68 unsigned height =
static_cast<unsigned int>(m_bb.getHeight());
73 for (std::shared_ptr<vpPanda3DBaseRenderer> &subrenderer :
m_subRenderers) {
74 subrenderer->setRenderParameters(subParams);
85 std::shared_ptr<vpPanda3DBaseRenderer> subrenderer =
m_subRenderers[0];
86 NodePath
object = subrenderer->getRenderRoot().find(m_focusedObject);
87 if (
object.is_empty()) {
92 object.calc_tight_bounds(minP, maxP);
93 const BoundingBox box(minP, maxP);
95 for (
unsigned int i = 0; i < 8; ++i) {
96 const LPoint3 p = box.get_point(i);
97 m_bb3DPoints.push_back(
vpColVector({ p.get_x(), -p.get_z(), p.get_y(), 1.0 }));
106 std::shared_ptr<vpPanda3DBaseRenderer> subrenderer =
m_subRenderers[0];
107 NodePath
object = subrenderer->getRenderRoot().find(m_focusedObject);
108 if (
object.is_empty()) {
111 if (m_shouldComputeBBPoints) {
113 m_shouldComputeBBPoints =
false;
118 float minZ = std::numeric_limits<float>::max(), maxZ = 0.f;
119 for (
unsigned int i = 0; i < m_bb3DPoints.size(); ++i) {
139 std::shared_ptr<vpPanda3DBaseRenderer> subrenderer =
m_subRenderers[0];
140 NodePath
object = subrenderer->getRenderRoot().find(m_focusedObject);
141 if (
object.is_empty()) {
144 if (m_shouldComputeBBPoints) {
146 m_shouldComputeBBPoints =
false;
151 double x = cpV[0] / cpV[2];
152 double y = cpV[1] / cpV[2];
165 for (
unsigned int i = 0; i < m_bb3DPoints.size(); ++i) {
166 const vpImagePoint ip = pointToPixel(camTobj, m_bb3DPoints[i]);
Generic class defining intrinsic camera parameters.
Implementation of column vector and the associated operations.
error that can be emitted by ViSP classes.
@ badValue
Used to indicate that a value is not in the allowed range.
Implementation of an homogeneous matrix and operations on such kind of matrices.
vpHomogeneousMatrix inverse() const
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
static T clamp(const T &v, const T &lower, const T &upper)
static void convertPoint(const vpCameraParameters &cam, const double &x, const double &y, double &u, double &v)
void computeClipping(float &nearV, float &farV)
vpObjectCentricRenderer(const vpPanda3DRenderParameters &renderParameters)
void computeBoundingBox3DPoints()
vpRect computeBoundingBox()
void beforeFrameRendered() VP_OVERRIDE
static const vpHomogeneousMatrix & vispToPanda()
vpPanda3DRenderParameters m_renderParameters
Pointer to owning window, which can create buffers etc. It is not necessarily visible.
Rendering parameters for a panda3D simulation.
void setClippingDistance(double nearV, double farV)
Set the clipping distance. When a panda camera uses these render parameters, objects that are closer ...
void setCameraIntrinsics(const vpCameraParameters &cam)
set camera intrinsics. Only camera intrinsics for a lens without distortion are supported.
double getFarClippingDistance() const
const vpCameraParameters & getCameraIntrinsics() const
Retrieve camera intrinsics.
double getNearClippingDistance() const
void setImageResolution(unsigned int height, unsigned int width)
Set the image resolution. When this object is given to a vpPanda3DBaseRenderer, this will be the reso...
std::vector< std::shared_ptr< vpPanda3DBaseRenderer > > m_subRenderers
vpHomogeneousMatrix getCameraPose() VP_OVERRIDE
Retrieve the pose of the camera. As this renderer contains multiple other renderers.
vpHomogeneousMatrix getNodePose(const std::string &name) VP_OVERRIDE
Retrieve the pose of a scene node. The pose is in the world frame, using a ViSP convention.
virtual void beforeFrameRendered() VP_OVERRIDE
Defines a rectangle in the plane.