File tree Expand file tree Collapse file tree 4 files changed +30
-0
lines changed Expand file tree Collapse file tree 4 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -153,13 +153,20 @@ namespace geode
153153 */
154154 void assign_attribute_value ( index_t from_element, index_t to_element );
155155
156+ /* !
157+ * Copy attribute value from other value in the same attribute
158+ * @param[in] from_element Attribute value to assign
159+ * @param[in] to_element Where the value is assign
160+ */
161+ void copy_attribute_value ( index_t from_element, index_t to_element );
156162 /* !
157163 * Interpolate attribute value from other values in the same attribute
158164 * @param[in] interpolation Attribute interpolator
159165 * @param[in] to_element Where the value is assign
160166 * @warning Only affect Attributes created with its AttributeProperties
161167 * interpolable flag set to true
162168 */
169+
163170 void interpolate_attribute_value (
164171 const AttributeLinearInterpolation& interpolation,
165172 index_t to_element );
Original file line number Diff line number Diff line change @@ -101,6 +101,17 @@ namespace geode
101101 }
102102 }
103103
104+ void copy_attribute_value ( index_t from_element,
105+ index_t to_element,
106+ const AttributeBase::AttributeKey &key )
107+ {
108+ for ( auto &attribute_it : attributes_ )
109+ {
110+ attribute_it.second ->compute_value (
111+ from_element, to_element, key );
112+ }
113+ }
114+
104115 void interpolate_attribute_value (
105116 const AttributeLinearInterpolation &interpolation,
106117 index_t to_element,
@@ -367,6 +378,12 @@ namespace geode
367378 impl_->assign_attribute_value ( from_element, to_element, {} );
368379 }
369380
381+ void AttributeManager::copy_attribute_value (
382+ index_t from_element, index_t to_element )
383+ {
384+ impl_->copy_attribute_value ( from_element, to_element, {} );
385+ }
386+
370387 void AttributeManager::interpolate_attribute_value (
371388 const AttributeLinearInterpolation &interpolation, index_t to_element )
372389 {
Original file line number Diff line number Diff line change 2727
2828#include < absl/memory/memory.h>
2929
30+ #include < geode/basic/attribute_manager.h>
3031#include < geode/basic/pimpl_impl.h>
3132
3233#include < geode/geometry/point.h>
@@ -236,6 +237,8 @@ namespace geode
236237 {
237238 const auto new_vertex_id =
238239 builder.create_point ( mesh.point ( vertex_id ) );
240+ mesh.vertex_attribute_manager ().copy_attribute_value (
241+ vertex_id, new_vertex_id );
239242 builder.replace_vertex ( vertex_id, new_vertex_id );
240243 for ( const auto & polygon_vertex : polygon_vertices )
241244 {
Original file line number Diff line number Diff line change 2727
2828#include < absl/memory/memory.h>
2929
30+ #include < geode/basic/attribute_manager.h>
3031#include < geode/basic/pimpl_impl.h>
3132
3233#include < geode/geometry/point.h>
@@ -233,6 +234,8 @@ namespace geode
233234 {
234235 const auto new_vertex_id =
235236 builder.create_point ( mesh.point ( vertex_id ) );
237+ mesh.vertex_attribute_manager ().copy_attribute_value (
238+ vertex_id, new_vertex_id );
236239 builder.replace_vertex ( vertex_id, new_vertex_id );
237240 for ( const auto & polyhedron_vertex : polyhedron_vertices )
238241 {
You can’t perform that action at this time.
0 commit comments