Skip to content

Commit 7b46dff

Browse files
author
Teseo Schneider
committed
unproject_on_plane
1 parent cce3d48 commit 7b46dff

File tree

2 files changed

+64
-56
lines changed

2 files changed

+64
-56
lines changed

src/unproject_on_plane.cpp

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#include <common.h>
2+
#include <npe.h>
3+
#include <typedefs.h>
4+
#include <igl/unproject_on_plane.h>
5+
6+
const char *ds_unproject_on_plane = R"igl_Qu8mg5v7(
7+
8+
Given a screen space point (u,v) and the current projection matrix (e.g.
9+
gl_proj * gl_modelview) and viewport, _unproject_ the point into the scene
10+
so that it lies on given plane.
11+
12+
13+
Parameters
14+
----------
15+
16+
UV 2-long uv-coordinates of screen space point
17+
M 4 by 4 projection matrix
18+
VP 4-long viewport: (corner_u, corner_v, width, height)
19+
P 4-long plane equation coefficients: P*(X 1) = 0
20+
21+
Returns
22+
-------
23+
Z 3-long world coordinate
24+
See also
25+
--------
26+
27+
28+
Notes
29+
-----
30+
None
31+
32+
Examples
33+
--------
34+
35+
)igl_Qu8mg5v7";
36+
37+
npe_function(unproject_on_plane)
38+
npe_doc(ds_unproject_on_plane)
39+
40+
npe_arg(uv, dense_float, dense_double)
41+
npe_arg(m, npe_matches(uv))
42+
npe_arg(vp, npe_matches(uv))
43+
npe_arg(p, npe_matches(uv))
44+
45+
46+
npe_begin_code()
47+
assert_size_equals(uv, 2, "uv");
48+
assert_rows_equals(m, 4, "m");
49+
assert_cols_equals(m, 4, "m");
50+
assert_size_equals(vp, 4, "uv");
51+
assert_size_equals(p, 4, "p");
52+
53+
EigenDense<npe_Scalar_uv> uv_copy = uv;
54+
EigenDense<npe_Scalar_uv> m_copy = m;
55+
EigenDense<npe_Scalar_uv> vp_copy = vp;
56+
Eigen::Matrix<npe_Scalar_uv, 4, 1> p_copy = p;
57+
58+
EigenDense<npe_Scalar_uv> z;
59+
igl::unproject_on_plane(uv_copy, m_copy, vp_copy, p_copy, z);
60+
return npe::move(z);
61+
62+
npe_end_code()
63+
64+

todo/unproject_on_plane.cpp

Lines changed: 0 additions & 56 deletions
This file was deleted.

0 commit comments

Comments
 (0)