33 plane(
const __m128 & rhs);
59 this->
vec = _mm_setr_ps(
a,
b,
c,
d);
69 this->
vec = _mm_setr_ps(n.
x, n.
y, n.
z,
d);
83 float d =
dot(cr, p0);
85 this->
vec = _mm_setr_ps(cr.
x, cr.
y, cr.
z,
d);
107 if (
d >= 0.0f &&
d <= 1.0f)
109 outIntersectPoint =
line.
b +
d * dv;
133 this->
vec = _mm_setr_ps(
a,
b,
c,
d);
166 if (d >= 0.0f && d <= 1.0f)
168 outIntersectPoint = startPoint + d * dv;
184 float n00 =
dot(n0, n0);
185 float n01 =
dot(n0, n1);
186 float n11 =
dot(n1, n1);
187 float det = n00 * n11 - n01 * n01;
195 float inv_det = 1.0f / det;
196 float c0 = (n11 * p1.
d - n01 * p2.
d) * inv_det;
197 float c1 = (n00 * p2.
d - n01 * p1.
d) * inv_det;
198 outLine.
m =
cross(n0, n1);
199 outLine.
b =
vec4(n0 * c0 + n1 * c1, 1);
231 outClippedLine.
set(l.
start(), clipPoint);
235 outClippedLine.
set(clipPoint, l.
end());
248 return _mm_cvtss_f32(_mm_dp_ps(p.
vec, v1.
vec, 0xF1));
276 __m128 x = _mm_shuffle_ps(p.
vec, p.
vec, _MM_SHUFFLE(0, 0, 0, 0));
277 __m128 y = _mm_shuffle_ps(p.
vec, p.
vec, _MM_SHUFFLE(1, 1, 1, 1));
278 __m128 z = _mm_shuffle_ps(p.
vec, p.
vec, _MM_SHUFFLE(2, 2, 2, 2));
279 __m128 w = _mm_shuffle_ps(p.
vec, p.
vec, _MM_SHUFFLE(3, 3, 3, 3));
282 _mm_add_ps(_mm_mul_ps(x, m.
r[0].
vec), _mm_mul_ps(y, m.
r[1].
vec)),
283 _mm_add_ps(_mm_mul_ps(z, m.
r[2].
vec), _mm_mul_ps(w, m.
r[3].
vec))
Type
Definition clipstatus.h:22
@ Outside
Definition clipstatus.h:24
@ Inside
Definition clipstatus.h:23
@ Clipped
Definition clipstatus.h:25
A line in 3d space.
Definition line.h:22
point end() const
get end point
Definition line.h:123
void set(const point &startPoint, const point &endPoint)
set start and end point
Definition line.h:94
point b
Definition line.h:55
const point & start() const
get start point
Definition line.h:114
vector m
Definition line.h:56
#define n_assert(exp)
Definition debug.h:50
Different curves.
Definition angularpfeedbackloop.h:17
__forceinline vec3 cross(const vec3 &v0, const vec3 &v1)
Definition vec3.h:417
point get_point(const plane &plane)
Definition plane.h:151
__forceinline scalar length3(const vec4 &v)
Definition vec4.h:395
bool intersectline(const plane &plane, const point &startPoint, const point &endPoint, point &outIntersectPoint)
Definition plane.h:160
__forceinline scalar dot(const plane &p, const vec4 &v1)
Definition plane.h:246
__forceinline plane normalize(const plane &p)
Definition plane.h:255
ClipStatus::Type clip(const plane &plane, const line &l, line &outClippedLine)
Definition plane.h:208
float scalar
Definition scalar.h:45
half operator*(half one, half two)
Definition half.h:123
bool intersectplane(const plane &p1, const plane &p2, line &outLine)
TODO: Test and make sure it produces correct intersection line.
Definition plane.h:180
static const __m128 _mask_xyz
Definition vec3.h:37
vector get_normal(const plane &plane)
Definition plane.h:140
Nebula's scalar datatype.
#define N_TINY
Definition scalar.h:43
A 4x4 single point precision float matrix.
Definition mat4.h:49
vec4 r[4]
as a two-dimensional array
Definition mat4.h:132
A mathematical plane represented by a normal and a distance from origin.
Definition plane.h:22
float a
Definition plane.h:48
plane()=default
default constructor, NOTE: does NOT setup components!
vector get_normal() const
get normal from plane
Definition plane.h:120
void set(scalar a, scalar b, scalar c, scalar d)
set content
Definition plane.h:131
float d
Definition plane.h:48
float c
Definition plane.h:48
__m128 vec
Definition plane.h:45
float b
Definition plane.h:48
bool intersect(line const &line, point &outIntersectPoint)
check intersection against line
Definition plane.h:101
Represents a 3D point in space.
Definition point.h:22
A 4D vector.
Definition vec4.h:24
__m128 vec
Definition vec4.h:95
A vector is a 3D direction in space.
Definition vector.h:22
__m128 vec
Definition vector.h:82
float z
Definition vector.h:85
float x
Definition vector.h:85
float y
Definition vector.h:85