forked from IntelRealSense/librealsense
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
75 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,14 @@ | ||
// License: Apache 2.0. See LICENSE file in root directory. | ||
// Copyright(c) 2021 Intel Corporation. All Rights Reserved. | ||
|
||
// Copyright(c) 2024 Intel Corporation. All Rights Reserved. | ||
#pragma once | ||
|
||
#include <cmath> // sqrt, sqrtf | ||
#include <rsutils/number/float3.h> | ||
|
||
|
||
namespace rs2 { | ||
|
||
|
||
struct float2 | ||
{ | ||
float x, y; | ||
|
||
float length() const { return sqrt( x * x + y * y ); } | ||
|
||
float2 normalize() const { return { x / length(), y / length() }; } | ||
}; | ||
|
||
inline float dot( const float2 & a, const float2 & b ) | ||
{ | ||
return a.x * b.x + a.y * b.y; | ||
} | ||
using rsutils::number::float2; | ||
|
||
|
||
} // namespace rs2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,14 @@ | ||
// License: Apache 2.0. See LICENSE file in root directory. | ||
// Copyright(c) 2021 Intel Corporation. All Rights Reserved. | ||
|
||
// Copyright(c) 2024 Intel Corporation. All Rights Reserved. | ||
#pragma once | ||
|
||
#include <cmath> // sqrt, sqrtf | ||
#include <rsutils/number/float3.h> | ||
|
||
|
||
namespace rs2 { | ||
|
||
|
||
struct float3 | ||
{ | ||
float x, y, z; | ||
|
||
float length() const { return sqrt( x * x + y * y + z * z ); } | ||
|
||
float3 normalize() const { return ( length() > 0 ) ? float3{ x / length(), y / length(), z / length() } : *this; } | ||
}; | ||
|
||
inline float3 cross( const float3 & a, const float3 & b ) | ||
{ | ||
return { a.y * b.z - b.y * a.z, a.x * b.z - b.x * a.z, a.x * b.y - a.y * b.x }; | ||
} | ||
|
||
inline float operator*(const float3& a, const float3& b) { | ||
return a.x * b.x + a.y * b.y + a.z * b.z; | ||
} | ||
|
||
inline float3 operator*( const float3 & a, float t ) | ||
{ | ||
return { a.x * t, a.y * t, a.z * t }; | ||
} | ||
|
||
inline float3 operator/( const float3 & a, float t ) | ||
{ | ||
return { a.x / t, a.y / t, a.z / t }; | ||
} | ||
|
||
inline float3 operator+( const float3 & a, const float3 & b ) | ||
{ | ||
return { a.x + b.x, a.y + b.y, a.z + b.z }; | ||
} | ||
|
||
inline float3 operator-( const float3 & a, const float3 & b ) | ||
{ | ||
return { a.x - b.x, a.y - b.y, a.z - b.z }; | ||
} | ||
using rsutils::number::float3; | ||
|
||
|
||
} // namespace rs2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters