Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-09-18Curves: Correct and improve Catmull Rom interpolationMattias Fredriksson
Correct interpolation of integer POD types for Catmull Rom interpolation as implemented in eaf416693dcb. **Problem description** `attribute_math::DefaultMixer<T>::mix_in()` assumes/asserts positive weights but the basis function for Catmull-Rom splines generates negative weights (see image in revision). Passing negative weights will yield correct result as sum(weights) = 1 (after multiplication by 0.5) but the assert is still triggered in debug builds. This patch adjusts the behavior by extending the mix functions with mix4(). The benefit of using mix#() over a DefaultMixer is that the result no longer needs to be divided by the weight sum, instead utilizing that the basis weight sum is constant (see plot). **Changes** * Added mix4() and updated catmull_rom::interpolate() to use it. * Removed TODOs from catmull_rom functions. * Moved mix definitions to be ordered as 2, 3, 4 in the header. **Implementation specifics** `catmull_rom::interpolate()` uses a constexpr to differentiate between POD types which multiplies the result with 0.5 after weighting the values, this reduces the number of multiplications for 1D, 2D, 3D vectors (https://godbolt.org/z/8M1z9Pxx6). While this could be considered unnecessary, I didn't want to change the original behavior as it could influence performance (did not measure performance here as this should ensure the logic is ~identical for FP types). Differential Revision: https://developer.blender.org/D15997
2022-09-13Geometry Nodes: Port the trim curve node to the new data-blockMattias Fredriksson
The trim functionality is implemented in the geometry module, and generalized a bit to be potentially useful for bisecting in the future. The implementation is based on a helper type called `IndexRangeCyclic` which allows iteration over all control points between two points on a curve. Catmull Rom curves are now supported-- trimmed without resampling first. However, maintaining the exact shape is not possible. NURBS splines are still converted to polylines using the evaluated curve concept. Performance is equivalent or faster then a 3.1 build with regards to node timings. Compared to 3.3 and 3.2, it's easy to observe test cases where the node is at least 3 or 4 times faster. Differential Revision: https://developer.blender.org/D14481
2022-07-06Curves: Port subdivide node to the new data-blockHans Goudey
This commit moves the subdivide curve node implementation to the geometry module, changes it to work on the new curves data-block, and adds support for Catmull Rom curves. Internally I also added support for a curve domain selection. That isn't used, but it's nice to have the option anyway. Users should notice better performance as well, since we can avoid many small allocations, and there is no conversion to and from the old curve type. The code uses a similar structure to the resample node (60a6fbf5b599) and the set type node (9e393fc2f125). The resample curves node can be restructured to be more similar to this soon though. Differential Revision: https://developer.blender.org/D15334
2022-07-04Cleanup: Rename curve segment count functionHans Goudey
`curve_segment_num` -> `segments_num`. The "curve" prefix is reduntant for a function in the curve namespace.
2022-05-11Cleanup: use '_num' suffix, mostly for curves & spline codeCampbell Barton
Replace tot/amount & size with num, in keeping with T85728.
2022-03-30Fix: Failing curves test after recent commitHans Goudey
87e9451d660e8288d missed updating the behavior for Catmull Rom curves.
2022-03-25Cleanup: Further renaming in new curves codeHans Goudey
A follow-up to e253f9f66d6f. Follow the policy from T85728 completely (using "num" as a prefix) and rename another function.
2022-03-24Cleanup: Adjust naming in new curves codeHans Goudey
Rename "size" variables and functions to use "num" instead, based on T85728 (though this doesn't apply to simple C++ containers, it applies here). Rename "range" to "points" in some functions, so be more specific. Differential Revision: https://developer.blender.org/D14431
2022-03-19BLI: move generic data structures to blenlibJacques Lucke
This is a follow up to rB2252bc6a5527cd7360d1ccfe7a2d1bc640a8dfa6.
2022-03-16Curves: Initial evaluation for curves data-blockHans Goudey
This patch adds evaluation for NURBS, Bezier, and Catmull Rom curves for the new `Curves` data-block. The main difference from the code in `BKE_spline.hh` is that the functionality is not encapsulated in classes. Instead, each function has arguments for all of the information it needs. This makes the code more reusable and removes a bunch of unnecessary complications for keeping track of state. NURBS and Bezier evaluation works the same way as existing code. The Catmull Rom implementation is new, with the basis function based on Cycles code. All three types have some basic tests. For NURBS and Catmull Rom curves, evaluating positions is the same as any generic attribute, so it's implemented by the generic interpolation to evaluated points. Bezier curves are a bit special, because the "handle" control points are stored in a separate attribute. This patch doesn't include generic interpolation to evaluated points for Bezier curves. Ref T95942 Differential Revision: https://developer.blender.org/D14284