You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems to me that the minus sign is by mistake applied twice when passing the d into create().
Considering that create does not changes values, only packs into array [*normal, distance], than distance there is equivalent to the d in the comment defining the plane equation -d = ax+bx+xz.
So that [nx, ny, nx, distance ] equivalent to [a, b, c, d] up to normalization.
It is calculated correctly on the next line with required minus d = -np.sum(n * position).
However the sign is changed again when passed to create(n, -d, dtype)
@parameters_as_numpy_arrays('position', 'normal')defcreate_from_position(position, normal, dtype=None):
dtype=dtypeorposition.dtype# -d = a * x + b * y + c * zn=vector.normalize(normal)
d=-np.sum(n*position)
returncreate(n, -d, dtype)
defcreate(normal=None, distance=0.0, dtype=None):
ifnormalisNone:
normal= [0.0, 0.0, 1.0]
returnnp.array([normal[0], normal[1], normal[2], distance], dtype=dtype)
As a result, when creating a plane in this simple case:
It seems to me that the minus sign is by mistake applied twice when passing the
d
intocreate()
.Considering that
create
does not changes values, only packs into array[*normal, distance]
, thandistance
there is equivalent to thed
in the comment defining the plane equation-d = ax+bx+xz
.So that
[nx, ny, nx, distance ]
equivalent to[a, b, c, d]
up to normalization.It is calculated correctly on the next line with required minus
d = -np.sum(n * position)
.However the sign is changed again when passed to
create(n, -d, dtype)
As a result, when creating a plane in this simple case:
the result does not satisfy the plane equation
p*n + d = 0
for position:Unless I am missing something, I suggest to remove the minus in the call to
create
:The text was updated successfully, but these errors were encountered: