Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Philip Trettner
polymesh
Commits
4969a0c9
Commit
4969a0c9
authored
Aug 29, 2018
by
Philip Trettner
Browse files
working on tracing
parent
866ff765
Changes
2
Hide whitespace changes
Inline
Side-by-side
Readme.md
View file @
4969a0c9
...
...
@@ -4,6 +4,29 @@ A lightweight half-edge data structure.
Best used with glm and glow.
## Function parameter order guide
The following types of parameters exist:
*
M (
`Mesh const& m`
or
`Mesh& m`
) reference to mesh (depending on topology is modified)
*
RO-A (
`attribute<T> const&`
) read-only attributes such as position
*
RW-A (
`attribute<T>&`
) read-write attributes
*
OPT-A (
`attribute<T>* = nullptr`
or
`attribute<T> const* = nullptr`
) optional attributes
*
H (
`handle h`
) handle
*
M-P: other mandatory parameters
*
OPT-P: other optional parameters
*
OUT-P: output parameters (that don't fit in the return value)
Free functions that perform mesh-related algorithms follow these rules for their parameters:
*
Mesh (M) or handle (H) is first parameter ("what does this function operates on?")
*
Followed by all required RO-A such as
`position`
*
Followed by all mandatory parameters M-P
*
Followed by all additional outputs RW-A and OUT-P
*
Finalized by all optional parameters OPT-A and OPT-P (least frequently used parameter should be last)
## TODO
*
Properties
...
...
src/polymesh/algorithms/tracing.hh
0 → 100644
View file @
4969a0c9
#pragma once
#include
"../Mesh.hh"
#include
"../fields.hh"
namespace
polymesh
{
/**
* Traces a ray inside the triangle stopping at the next edge
*/
/// Traces from halfedge h into its triangle
/// Start point is given by interpolating h.from and h.to given x
/// Direction is given by virtual source with SQUARED distance d1_sqr from h.from and d2_sqr from h.to
/// Returns intersecting half-edge and new x parameter
template
<
class
Scalar
=
float
,
class
EdgeLengthF
>
std
::
pair
<
halfedge_handle
,
float
>
trace_step
(
halfedge_handle
h
,
EdgeLengthF
&&
edge_length
,
Scalar
x
,
Scalar
d1_sqr
,
Scalar
d2_sqr
);
/// ======== IMPLEMENTATION ========
template
<
class
Scalar
,
class
EdgeLengthF
>
std
::
pair
<
halfedge_handle
,
float
>
trace_step
(
halfedge_handle
h
,
EdgeLengthF
&&
edge_length
,
Scalar
x
,
Scalar
d1_sqr
,
Scalar
d2_sqr
)
{
assert
(
!
h
.
is_boundary
()
&&
"cannot trace into boundary"
);
auto
f
=
h
.
face
();
assert
(
f
.
vertices
().
size
()
==
3
&&
"only supports triangles"
);
// TODO
}
}
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment