MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ write_curve_segment()

void MayaFlux::Nodes::GpuSync::PathGeneratorNode::write_curve_segment ( const std::vector< LineVertex > &  curve_verts,
size_t  start_idx,
LineVertex *  dst 
)
private

Evaluate one window and write its vertices.

Parameters
curve_vertsControl point source.
start_idxFirst control point of the window.
dstDestination for vertices_per_window() vertices.

Definition at line 105 of file PathGeneratorNode.cpp.

109{
110 if (start_idx + 3 >= curve_verts.size()) {
111 return;
112 }
113
115
116 for (size_t i = 0; i < 4; ++i) {
117 const auto& pt = curve_verts[start_idx + i].position;
118 m_segment_controls[i * 3 + 0] = pt.x;
119 m_segment_controls[i * 3 + 1] = pt.y;
120 m_segment_controls[i * 3 + 2] = pt.z;
121 }
122
125
126 const std::vector<double>* curve = &m_curve_primary;
127
131 curve = &m_curve_secondary;
132 }
133
134 const auto count = static_cast<size_t>(m_samples_per_segment);
135 if (count < 2) {
136 return;
137 }
138
139 const double* x = curve->data();
140 const double* y = x + count;
141 const double* z = y + count;
142
145 }
146
147 const double* tx = m_curve_tangents.data();
148 const double* ty = tx + count;
149 const double* tz = ty + count;
150
151 const auto sample = [&](size_t s) {
152 return glm::vec3 {
153 static_cast<float>(x[s]), static_cast<float>(y[s]), static_cast<float>(z[s])
154 };
155 };
156
157 const auto tangent = [&](size_t s) {
158 return glm::vec3 {
159 static_cast<float>(tx[s]), static_cast<float>(ty[s]), static_cast<float>(tz[s])
160 };
161 };
162
163 for (size_t i = 0; i < count - 1; ++i) {
164 dst[i * 2].position = sample(i);
165 dst[i * 2].tangent = tangent(i);
166 dst[i * 2 + 1].position = sample(i + 1);
167 dst[i * 2 + 1].tangent = tangent(i + 1);
168 }
169
170 write_segment_attributes(curve_verts, start_idx, dst);
171}
uint32_t * dst
uint32_t tangent
size_t count
void evaluate_planar(std::span< const double > control_points, size_t dim, Eigen::Index num_samples, std::vector< double > &out, std::vector< double > &tangents)
Evaluate a curve into coordinate-major position and tangent buffers.
void reparameterize_planar(std::span< const double > points, size_t dim, Eigen::Index point_count, Eigen::Index num_samples, std::vector< double > &out)
Resample a polyline to uniform arc length, coordinate-major.
void configure(InterpolationMode mode, double tension)
Re-resolve the kernel.
void write_segment_attributes(const std::vector< LineVertex > &curve_verts, size_t start_idx, LineVertex *dst) const
Write colour and thickness for one window, leaving positions intact.
void central_difference_tangents(std::span< const double > points, size_t dim, size_t count, std::vector< double > &tangents)
Tangents of a sampled curve by finite difference, coordinate-major.

References MayaFlux::Kinesis::central_difference_tangents(), MayaFlux::Kinesis::CurveEvaluator::configure(), count, dst, MayaFlux::Kinesis::CurveEvaluator::evaluate_planar(), m_arc_length_parameterization, m_curve_primary, m_curve_secondary, m_curve_tangents, m_evaluator, m_mode, m_samples_per_segment, m_segment_controls, m_tension, MayaFlux::Kinesis::CurveEvaluator::reparameterize_planar(), tangent, and write_segment_attributes().

Referenced by complete(), generate_interpolated_path(), and regenerate_segment_range().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: