Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Institute of Technical Acoustics (ITA)
toolbox
Commits
79d8f57c
Commit
79d8f57c
authored
Aug 27, 2020
by
Marco Berzborn
Browse files
added individual polygon surface area calculation method to AC3D Model class
parent
ddd0c900
Changes
1
Hide whitespace changes
Inline
Side-by-side
applications/SoundFieldSimulation/Raven/AC3D/itaAc3dModel.m
View file @
79d8f57c
...
...
@@ -339,6 +339,47 @@ classdef itaAc3dModel
S
=
obj
.
totalSurface
;
end
function
[
surfacePolygons
,
surfacePolygonsMaterial
]
=
getSurfacePolygons
(
obj
)
% Calculate the surface area of individual mesh polygons.
% First return value is the surface of all polygons. Second
% return value is the surface of all polygons grouped by their
% assigned materials.
triaID
=
1
;
for
matID
=
1
:
length
(
obj
.
bcGroups
)
for
polyID
=
1
:
length
(
obj
.
bcGroups
{
matID
}
.
polygons
)
for
vertID
=
1
:(
length
(
obj
.
bcGroups
{
matID
}
.
polygons
{
polyID
}(:,
1
))
-
2
)
node1
=
obj
.
nodes
(
obj
.
bcGroups
{
matID
}
.
polygons
{
polyID
}(
1
),:);
node2
=
obj
.
nodes
(
obj
.
bcGroups
{
matID
}
.
polygons
{
polyID
}(
vertID
+
1
),:);
node3
=
obj
.
nodes
(
obj
.
bcGroups
{
matID
}
.
polygons
{
polyID
}(
vertID
+
2
),:);
% Dreieck nach Triangulation abspeichern
triangles
{
triaID
}
=
[
node1
;
node2
;
node3
];
% Fl?chenberechnung f?r Dreieck
a
=
norm
(
node1
-
node2
);
b
=
norm
(
node1
-
node3
);
c
=
norm
(
node2
-
node3
);
surfPoly
=
real
(
1
/
4
*
sqrt
(
(
a
+
b
+
c
)
*
(
-
a
+
b
+
c
)
*
(
a
-
b
+
c
)
*
(
a
+
b
-
c
)
)
);
surfacePolygons
(
triaID
)
=
surfPoly
;
surfacePolygonsMaterial
{
matID
}(
polyID
)
=
surfPoly
;
% Normalenberechnung f?r Dreieck
if
norm
(
cross
(
(
node2
-
node1
),
(
node3
-
node1
)
)
)
==
0
% Schutz gegen Kr?ppel Linien Polygone
normals
{
triaID
}
=
[
0
0
0
];
else
normals
{
triaID
}
=
cross
(
(
node2
-
node1
),
(
node3
-
node1
)
)
/
norm
(
cross
(
(
node2
-
node1
),
(
node3
-
node1
)
)
);
end
% Index inkrement
triaID
=
triaID
+
1
;
end
end
end
end
function
SMat
=
getMaterialSurface
(
obj
,
materialName
)
% sometimes multiple materials with the same name are defined. in this case, sum up all of them
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment