1 #ifndef GIM_CLIP_POLYGON_H_INCLUDED
2 #define GIM_CLIP_POLYGON_H_INCLUDED
40 template <
typename CLASS_POINT,
typename CLASS_PLANE>
47 template <
typename CLASS_POINT>
49 const CLASS_POINT& point0,
50 const CLASS_POINT& point1,
58 if (_classif != _prevclassif)
60 GREAL blendfactor = -dist0 / (dist1 - dist0);
61 VEC_BLEND(clipped[clipped_count], point0, point1, blendfactor);
66 VEC_COPY(clipped[clipped_count], point1);
75 template <
typename CLASS_POINT,
typename CLASS_PLANE,
typename DISTANCE_PLANE_FUNC>
77 const CLASS_PLANE& plane,
78 const CLASS_POINT* polygon_points,
79 GUINT polygon_point_count,
80 CLASS_POINT* clipped, DISTANCE_PLANE_FUNC distance_func)
82 GUINT clipped_count = 0;
85 GREAL firstdist = distance_func(plane, polygon_points[0]);
89 VEC_COPY(clipped[clipped_count], polygon_points[0]);
93 GREAL olddist = firstdist;
94 for (
GUINT _i = 1; _i < polygon_point_count; _i++)
96 GREAL dist = distance_func(plane, polygon_points[_i]);
99 polygon_points[_i - 1], polygon_points[_i],
111 polygon_points[polygon_point_count - 1], polygon_points[0],
117 return clipped_count;
124 template <
typename CLASS_POINT,
typename CLASS_PLANE,
typename DISTANCE_PLANE_FUNC>
126 const CLASS_PLANE& plane,
127 const CLASS_POINT& point0,
128 const CLASS_POINT& point1,
129 const CLASS_POINT& point2,
130 CLASS_POINT* clipped, DISTANCE_PLANE_FUNC distance_func)
132 GUINT clipped_count = 0;
135 GREAL firstdist = distance_func(plane, point0);
139 VEC_COPY(clipped[clipped_count], point0);
144 GREAL olddist = firstdist;
145 GREAL dist = distance_func(plane, point1);
157 dist = distance_func(plane, point2);
175 return clipped_count;
178 template <
typename CLASS_POINT,
typename CLASS_PLANE>
180 const CLASS_PLANE& plane,
181 const CLASS_POINT* polygon_points,
182 GUINT polygon_point_count,
183 CLASS_POINT* clipped)
185 return PLANE_CLIP_POLYGON_GENERIC<CLASS_POINT, CLASS_PLANE>(plane, polygon_points, polygon_point_count, clipped,
DISTANCE_PLANE_3D_FUNC());
188 template <
typename CLASS_POINT,
typename CLASS_PLANE>
190 const CLASS_PLANE& plane,
191 const CLASS_POINT& point0,
192 const CLASS_POINT& point1,
193 const CLASS_POINT& point2,
194 CLASS_POINT* clipped)
196 return PLANE_CLIP_TRIANGLE_GENERIC<CLASS_POINT, CLASS_PLANE>(plane, point0, point1, point2, clipped,
DISTANCE_PLANE_3D_FUNC());
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a point
#define SIMD_FORCE_INLINE
This function calcs the distance from a 3D plane.
GREAL operator()(const CLASS_PLANE &plane, const CLASS_POINT &point)
#define DISTANCE_PLANE_POINT(plane, point)
SIMD_FORCE_INLINE GUINT PLANE_CLIP_POLYGON3D(const CLASS_PLANE &plane, const CLASS_POINT *polygon_points, GUINT polygon_point_count, CLASS_POINT *clipped)
SIMD_FORCE_INLINE GUINT PLANE_CLIP_TRIANGLE3D(const CLASS_PLANE &plane, const CLASS_POINT &point0, const CLASS_POINT &point1, const CLASS_POINT &point2, CLASS_POINT *clipped)
SIMD_FORCE_INLINE GUINT PLANE_CLIP_TRIANGLE_GENERIC(const CLASS_PLANE &plane, const CLASS_POINT &point0, const CLASS_POINT &point1, const CLASS_POINT &point2, CLASS_POINT *clipped, DISTANCE_PLANE_FUNC distance_func)
Clips a polygon by a plane.
SIMD_FORCE_INLINE void PLANE_CLIP_POLYGON_COLLECT(const CLASS_POINT &point0, const CLASS_POINT &point1, GREAL dist0, GREAL dist1, CLASS_POINT *clipped, GUINT &clipped_count)
SIMD_FORCE_INLINE GUINT PLANE_CLIP_POLYGON_GENERIC(const CLASS_PLANE &plane, const CLASS_POINT *polygon_points, GUINT polygon_point_count, CLASS_POINT *clipped, DISTANCE_PLANE_FUNC distance_func)
Clips a polygon by a plane.
#define VEC_COPY(b, a)
Copy 3D vector.
#define VEC_BLEND(vr, a, b, s)