-
Notifications
You must be signed in to change notification settings - Fork 41
add area and volume calculations #144
add area and volume calculations #144
Conversation
It's not a replacement for the area method of Adding that gts parser and a relatively large mesh with it for testing is a bit overkill though, imho. I would suggest to just build a small mesh (e.g. a cube, has the advantage that it's obvious how large the volume/area should be) directly in the code and use that for testing. |
Sorry for completely ignoring this! @CarpeNecopinum probably has a better idea ;) I basically just copy & pasted the area code for a single purpose usage -.- |
how do i get a properly oriented cube? cube = HyperRectangle(Vec3f0(-0.5), Vec3f0(1))
cube_faces = decompose(Face{3,Int32}, cube)
cube_vertices = decompose(Point{3,Float32}, cube) |> Array but the volume computes to zero... |
why do I get the comments, if I rebase? |
When you rebase against master, it makes new commits that have the same messages, but different hashes. You should have merged master instead. Happened to me earlier today, too. 😅 |
that indeed does look better |
I just found out that the faces of a 3d HyperRectangle are inconsistently oriented, so you getting a volume of zero is actually the "correct" result (i.e. your algorithm does nothing wrong here). You should be able to test your algorithm with the branch in #183, there I fixed the orientation so all faces point outwards (with counter-clockwise winding order). |
Thanks! This is fine now |
Is this mergable then? |
b = v3 - v1 | ||
cross(a, b) | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't call this normal
, as the actual normal is the normalized version of this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
too much of a pun, if I name it unnormal
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
edge_cross_product
maybe? Personally I'd probably just keep it as a local function inside the other ones. Even though you'd have the same code twice then...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re: Silly names. What about normal_times_twice_the_area
? 🤓
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe something like orthogonal_vector
?
|
Thanks! |
Implement calculation of area and volume
This is one of my first PRs so I'm not sure, if it meets the specifics of this package entirely.
The
area
function may or may not be a substitute forGeometryTypes.jl/src/polygons.jl
Line 16 in 649fe6f