@@ -129,10 +129,7 @@ impl PointDomain {
129129 }
130130
131131 pub fn push ( & mut self , id : PointId , position : DVec2 ) {
132- if self . id . contains ( & id) {
133- warn ! ( "Duplicate point" ) ;
134- return ;
135- }
132+ debug_assert ! ( !self . id. contains( & id) ) ;
136133 self . id . push ( id) ;
137134 self . positions . push ( position) ;
138135 }
@@ -292,22 +289,13 @@ impl SegmentDomain {
292289 }
293290
294291 pub ( crate ) fn push ( & mut self , id : SegmentId , start : usize , end : usize , handles : bezier_rs:: BezierHandles , stroke : StrokeId ) {
295- if self . ids . contains ( & id) {
296- return ;
297- }
298- // Attempt to keep line joins?
299- let after = self . end_point . iter ( ) . copied ( ) . position ( |other_end| other_end == start) ;
300- let before = self . start_point . iter ( ) . copied ( ) . position ( |other_start| other_start == end) ;
301- let index = match ( before, after) {
302- ( _, Some ( after) ) => after + 1 ,
303- ( Some ( before) , _) => before,
304- ( None , None ) => self . ids . len ( ) ,
305- } ;
306- self . ids . insert ( index, id) ;
307- self . start_point . insert ( index, start) ;
308- self . end_point . insert ( index, end) ;
309- self . handles . insert ( index, handles) ;
310- self . stroke . insert ( index, stroke) ;
292+ debug_assert ! ( !self . ids. contains( & id) , "Tried to push an existing point to a point domain" ) ;
293+
294+ self . ids . push ( id) ;
295+ self . start_point . push ( start) ;
296+ self . end_point . push ( end) ;
297+ self . handles . push ( handles) ;
298+ self . stroke . push ( stroke) ;
311299 }
312300
313301 pub ( crate ) fn start_point_mut ( & mut self ) -> impl Iterator < Item = ( SegmentId , & mut usize ) > {
0 commit comments