Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
nt1100 analyser
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pascal Engeler
nt1100 analyser
Commits
d2136abf
Commit
d2136abf
authored
2 years ago
by
Pascal Engeler
Browse files
Options
Downloads
Patches
Plain Diff
More vec3 operations
parent
7e30070a
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/utility.hpp
+6
-0
6 additions, 0 deletions
include/utility.hpp
src/utility.cpp
+19
-0
19 additions, 0 deletions
src/utility.cpp
with
25 additions
and
0 deletions
include/utility.hpp
+
6
−
0
View file @
d2136abf
...
...
@@ -26,10 +26,16 @@ unsigned ij2index(unsigned i, unsigned j, unsigned Ny);
std
::
array
<
float
,
3
>
operator
+=
(
std
::
array
<
float
,
3
>&
,
const
std
::
array
<
float
,
3
>&
);
std
::
array
<
float
,
3
>
operator
-
(
std
::
array
<
float
,
3
>
,
const
std
::
array
<
float
,
3
>&
);
std
::
array
<
float
,
3
>
cross
(
const
std
::
array
<
float
,
3
>&
,
const
std
::
array
<
float
,
3
>&
);
std
::
array
<
float
,
3
>
operator
/=
(
std
::
array
<
float
,
3
>&
,
const
float
);
float
length
(
const
std
::
array
<
float
,
3
>&
);
std
::
array
<
float
,
3
>
normal
(
const
std
::
array
<
float
,
3
>&
,
const
std
::
array
<
float
,
3
>&
,
const
std
::
array
<
float
,
3
>&
);
glm
::
mat4
scale_z
(
float
z0
,
float
factor
);
...
...
This diff is collapsed.
Click to expand it.
src/utility.cpp
+
19
−
0
View file @
d2136abf
...
...
@@ -45,6 +45,13 @@ std::array<float, 3> operator+=(std::array<float, 3>& lhs, const std::array<floa
return
lhs
;
}
std
::
array
<
float
,
3
>
operator
-
(
std
::
array
<
float
,
3
>
lhs
,
const
std
::
array
<
float
,
3
>&
rhs
)
{
lhs
[
0
]
-=
rhs
[
0
];
lhs
[
1
]
-=
rhs
[
1
];
lhs
[
2
]
-=
rhs
[
2
];
return
lhs
;
}
std
::
array
<
float
,
3
>
cross
(
const
std
::
array
<
float
,
3
>&
v
,
const
std
::
array
<
float
,
3
>&
w
){
std
::
array
<
float
,
3
>
cp
;
cp
[
0
]
=
v
[
1
]
*
w
[
2
]
-
v
[
2
]
*
w
[
1
];
...
...
@@ -62,6 +69,18 @@ std::array<float, 3> operator/=(std::array<float, 3>& v, const float d){
return
v
;
}
float
length
(
const
std
::
array
<
float
,
3
>&
v
)
{
return
std
::
sqrt
(
v
[
0
]
*
v
[
0
]
+
v
[
1
]
*
v
[
1
]
+
v
[
2
]
*
v
[
2
]);
}
std
::
array
<
float
,
3
>
normal
(
const
std
::
array
<
float
,
3
>&
p1
,
const
std
::
array
<
float
,
3
>&
p2
,
const
std
::
array
<
float
,
3
>&
p3
)
{
std
::
array
<
float
,
3
>
v1
=
p2
-
p1
;
std
::
array
<
float
,
3
>
v2
=
p3
-
p1
;
std
::
array
<
float
,
3
>
crs
=
cross
(
v1
,
v2
);
crs
/=
length
(
crs
);
return
crs
;
}
glm
::
mat4
scale_z
(
float
z0
,
float
factor
){
glm
::
mat4
transf
(
1.
f
);
transf
=
glm
::
translate
(
glm
::
scale
(
glm
::
translate
(
transf
,
glm
::
vec3
(
0.
f
,
0.
f
,
-
z0
)),
glm
::
vec3
(
1.
,
1.
,
factor
)),
glm
::
vec3
(
0.
,
0.
,
z0
));
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment