Cogs.Core
BeamUtils.h
1#pragma once
2#include "Resources/Resources.h"
3#include "Components/BeamGroupComponent.h" // Topology enum
4
5#include "Foundation/Memory/MemoryBuffer.h"
6
7#include <glm/glm.hpp>
8
9#include <vector>
10
11namespace Cogs
12{
13 namespace Core
14 {
15 class Context;
16
17 namespace EchoSounder
18 {
19
20 // \param alpha OwnShip/Transducer/TransducerAlpha[X|Y|Z], converted from degrees to radians.
21 // \param offset OwnShip/Transducer/Offset[X|Y|Z] in meters.
22 void getArrayToVesselTransform(glm::quat& rotation,
23 glm::vec3& translation,
24 const glm::vec3& alpha,
25 const glm::vec3& offset);
26
27 // Build a beam direction in array coordinates.
28 glm::vec3 getBeamDir(uint32_t coordSys, float dirX, float dirY);
29
30 // Check if beams have the larger extent in x-direction than in y-direction
31 bool isXDominant(const std::vector<float> &directionX, const std::vector<float> &directionY);
32
33 void inflateFans(std::vector<float>& directionX,
34 std::vector<float>& directionY,
35 const std::vector<float>& inDirectionX,
36 const std::vector<float>& inBeamWidthX,
37 const std::vector<float>& inDirectionY,
38 const std::vector<float>& inBeamWidthY,
39 const std::vector<uint32_t>& beams,
40 const Topology topology,
41 const size_t minorCount);
42
43 void getBoundingFrustum(glm::vec4* planes,
44 const glm::quat& rotation,
45 const glm::vec3& translation,
46 const uint32_t coordSys,
47 const float minDirX, const float maxDirX,
48 const float minDirY, const float maxDirY,
49 const float depthMin, const float depthMax);
50
51 void getAxisAlignedBoundingBox(glm::vec3& minCorner,
52 glm::vec3& maxCorner,
53 const glm::quat& rotation,
54 const glm::vec3& translation,
55 const uint32_t coordSys,
56 const float minDirX, const float maxDirX,
57 const float minDirY, const float maxDirY,
58 const float depthMin, const float depthMax);
59
60 MeshHandle buildBeamBundleOutline(Context* context,
61 const glm::quat& rotation,
62 const glm::vec3& translation,
63 const uint32_t coordSys,
64 const float* dirX, const size_t nX,
65 const float* dirY, const size_t nY,
66 const float depthMin, const float depthMax);
67
68 void buildBeamBundleOutline2(std::vector<glm::vec3>& V,
69 std::vector<uint32_t>& indices,
70 Context* context,
71 const glm::quat& rotation,
72 const glm::vec3& translation,
73 const uint32_t coordSys,
74 const float* dirY, const size_t nY,
75 const float* dirX, const size_t nX,
76 const float depthMin, const float depthMax,
77 const bool minorClosed,
78 const bool individualBeams);
79
80
81 MeshHandle buildFrustumOutline(Context* context,
82 const glm::vec4* equations);
83
84
85 MeshHandle buildBoxOutline(Context* context,
86 const glm::vec3& minCorner,
87 const glm::vec3& maxCorner);
88
89 void clipVertical(Cogs::Memory::TypedBuffer<float> & values, size_t startValueIndex,
90 const glm::vec3 & beamStartPos,
91 const std::vector<glm::vec3> & beamDir, const size_t startBeamIndex,
92 const float minVerticalDepth, const float maxVerticalDepth,
93 const float depthOffset, const float depthStep, const float maxRange,
94 const size_t beamCount, const size_t sampleCount);
95 }
96 }
97}
Contains all Cogs related functionality.
Definition: FieldSetter.h:23