[PATCH] ruby: fix initialization of new_corridor.boundary_curves in Corridor#split
Sylvain Joyeux
sylvain.joyeux at m4x.org
Mon Jun 11 11:11:20 CEST 2012
The issue was that accessing new_corridor.boundary_curves creates
Spline objects, but the data is invalid (zero dimension).
Set the whole array at once.
---
ruby/corridor_plan.rb | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/ruby/corridor_plan.rb b/ruby/corridor_plan.rb
index 2ac4210..decfd62 100644
--- a/ruby/corridor_plan.rb
+++ b/ruby/corridor_plan.rb
@@ -94,15 +94,17 @@ Typelib.specialize '/corridors/Corridor_m' do
self.annotations[0] = old_annotations
new_corridor.annotations[0] = new_annotations
+ boundaries = []
2.times do |boundary_idx|
boundary_pos = associated_boundary(position, boundary_idx, 0.01).inject(&:+) / 2
result = boundary_curves[boundary_idx].split(boundary_pos)
- new_corridor.boundary_curves[boundary_idx] = result
+ boundaries[boundary_idx] = result
old_annotations, new_annotations = split_annotations(annotations[boundary_idx + 1], position)
self.annotations[boundary_idx + 1] = old_annotations
new_corridor.annotations[boundary_idx + 1] = new_annotations
end
+ new_corridor.boundary_curves = boundaries
new_corridor
end
--
1.7.10
--------------090300040306030001000408--
More information about the Rock-dev
mailing list