42 for(itCamera = itCamera.begin(&t_tree);
43 itCamera != itCamera.end();
49 std::string strAnchorId;
67 cProjectionMatrix(0,0) = cFocalLength.
GetX();
68 cProjectionMatrix(1,1) = cFocalLength.
GetY();
72 cProjectionMatrix(0,2) = cPrincipalPoint.
GetX();
73 cProjectionMatrix(1,2) = cPrincipalPoint.
GetY();
89 std::vector<CCameraSensorSimulatedAlgorithm*> vecSimulatedAlgorithms;
90 std::vector<CCI_CameraSensorAlgorithm*> vecAlgorithms;
92 for(itAlgorithm = itAlgorithm.begin(&(*itCamera));
93 itAlgorithm != itAlgorithm.end();
101 if(pcCIAlgorithm ==
nullptr) {
103 "\" does not inherit from CCI_CameraSensorAlgorithm");
106 pcCIAlgorithm->
Init(*itAlgorithm);
108 vecSimulatedAlgorithms.push_back(pcAlgorithm);
109 vecAlgorithms.push_back(pcCIAlgorithm);
112 m_vecSensors.emplace_back(sAnchor, cOffset, cRange, cProjectionMatrix,
113 cResolution, vecSimulatedAlgorithms);
134 std::vector<std::pair<bool, CRay3> >& vecCheckedRays =
140 CVector3 cCameraLocation, cLookAt, cUp;
142 CVector3 cNearCenter, cNearTopLeft, cNearTopRight, cNearBottomLeft, cNearBottomRight;
143 CVector3 cFarCenter, cFarTopLeft, cFarTopRight, cFarBottomLeft, cFarBottomRight;
144 std::array<CPlane, 6> arrFrustumPlanes;
145 CVector3 cBoundingBoxMinCorner, cBoundingBoxMaxCorner;
146 CVector3 cBoundingBoxPosition, cBoundingBoxHalfExtents;
150 cWorldToAnchorTransform.
SetFromComponents(s_sensor.Anchor.Orientation, s_sensor.Anchor.Position);
151 cWorldToCameraTransform = cWorldToAnchorTransform * s_sensor.Offset;
152 cCameraToWorldTransform = cWorldToCameraTransform.
GetInverse();
159 cZ = cCameraLocation - cLookAt;
167 cNearCenter = cCameraLocation - cZ * s_sensor.Range.GetMin();
168 cFarCenter = cCameraLocation - cZ * s_sensor.Range.GetMax();
169 cNearTopLeft = cNearCenter + (cY * s_sensor.NearPlaneHeight) - (cX * s_sensor.NearPlaneWidth);
170 cNearTopRight = cNearCenter + (cY * s_sensor.NearPlaneHeight) + (cX * s_sensor.NearPlaneWidth);
171 cNearBottomLeft = cNearCenter - (cY * s_sensor.NearPlaneHeight) - (cX * s_sensor.NearPlaneWidth);
172 cNearBottomRight = cNearCenter - (cY * s_sensor.NearPlaneHeight) + (cX * s_sensor.NearPlaneWidth);
173 cFarTopLeft = cFarCenter + (cY * s_sensor.FarPlaneHeight) - (cX * s_sensor.FarPlaneWidth);
174 cFarTopRight = cFarCenter + (cY * s_sensor.FarPlaneHeight) + (cX * s_sensor.FarPlaneWidth);
175 cFarBottomLeft = cFarCenter - (cY * s_sensor.FarPlaneHeight) - (cX * s_sensor.FarPlaneWidth);
176 cFarBottomRight = cFarCenter - (cY * s_sensor.FarPlaneHeight) + (cX * s_sensor.FarPlaneWidth);
179 vecCheckedRays.emplace_back(
false,
CRay3(cNearTopLeft, cNearTopRight));
180 vecCheckedRays.emplace_back(
false,
CRay3(cNearTopRight, cNearBottomRight));
181 vecCheckedRays.emplace_back(
false,
CRay3(cNearBottomRight, cNearBottomLeft));
182 vecCheckedRays.emplace_back(
false,
CRay3(cNearBottomLeft, cNearTopLeft));
183 vecCheckedRays.emplace_back(
false,
CRay3(cFarTopLeft, cFarTopRight));
184 vecCheckedRays.emplace_back(
false,
CRay3(cFarTopRight, cFarBottomRight));
185 vecCheckedRays.emplace_back(
false,
CRay3(cFarBottomRight, cFarBottomLeft));
186 vecCheckedRays.emplace_back(
false,
CRay3(cFarBottomLeft, cFarTopLeft));
187 vecCheckedRays.emplace_back(
false,
CRay3(cNearTopLeft, cFarTopLeft));
188 vecCheckedRays.emplace_back(
false,
CRay3(cNearTopRight, cFarTopRight));
189 vecCheckedRays.emplace_back(
false,
CRay3(cNearBottomRight, cFarBottomRight));
190 vecCheckedRays.emplace_back(
false,
CRay3(cNearBottomLeft, cFarBottomLeft));
194 cBoundingBoxMinCorner = cNearCenter;
195 cBoundingBoxMaxCorner = cNearCenter;
197 cNearTopLeft, cNearTopRight, cNearBottomLeft, cNearBottomRight,
198 cFarTopLeft, cFarTopRight, cFarBottomLeft, cFarBottomRight
200 if(c_point.GetX() > cBoundingBoxMaxCorner.
GetX()) {
201 cBoundingBoxMaxCorner.
SetX(c_point.GetX());
203 if(c_point.GetX() < cBoundingBoxMinCorner.
GetX()) {
204 cBoundingBoxMinCorner.
SetX(c_point.GetX());
206 if(c_point.GetY() > cBoundingBoxMaxCorner.
GetY()) {
207 cBoundingBoxMaxCorner.
SetY(c_point.GetY());
209 if(c_point.GetY() < cBoundingBoxMinCorner.
GetY()) {
210 cBoundingBoxMinCorner.
SetY(c_point.GetY());
212 if(c_point.GetZ() > cBoundingBoxMaxCorner.
GetZ()) {
213 cBoundingBoxMaxCorner.
SetZ(c_point.GetZ());
215 if(c_point.GetZ() < cBoundingBoxMinCorner.
GetZ()) {
216 cBoundingBoxMinCorner.
SetZ(c_point.GetZ());
219 cBoundingBoxMaxCorner *= 0.5;
220 cBoundingBoxMinCorner *= 0.5;
221 cBoundingBoxPosition = (cBoundingBoxMaxCorner + cBoundingBoxMinCorner);
222 cBoundingBoxHalfExtents = (cBoundingBoxMaxCorner - cBoundingBoxMinCorner);
224 arrFrustumPlanes[0].SetFromThreePoints(cNearTopRight, cNearTopLeft, cFarTopLeft);
225 arrFrustumPlanes[1].SetFromThreePoints(cNearBottomLeft, cNearBottomRight, cFarBottomRight);
226 arrFrustumPlanes[2].SetFromThreePoints(cNearTopLeft, cNearBottomLeft, cFarBottomLeft);
227 arrFrustumPlanes[3].SetFromThreePoints(cNearBottomRight, cNearTopRight, cFarBottomRight);
228 arrFrustumPlanes[4].SetFromThreePoints(cNearTopLeft, cNearTopRight, cNearBottomRight);
229 arrFrustumPlanes[5].SetFromThreePoints(cFarTopRight, cFarTopLeft, cFarBottomLeft);
232 pc_algorithm->
Update(s_sensor.ProjectionMatrix,
234 cCameraToWorldTransform,
236 cBoundingBoxPosition,
237 cBoundingBoxHalfExtents);
239 vecCheckedRays.insert(std::end(vecCheckedRays),