@@ -379,6 +379,54 @@ impl<PointId: Identifier> Subpath<PointId> {
379379
380380 Self :: new ( manipulator_groups, false )
381381 }
382+
383+ pub fn new_heart (
384+ center : DVec2 ,
385+ radius : f64 ,
386+ cleft_angle : f64 ,
387+ tip_angle : f64 ,
388+ left_bulb_height : f64 ,
389+ right_bulb_height : f64 ,
390+ left_bulb_expand : f64 ,
391+ right_bulb_expand : f64 ,
392+ cleft_depth : f64 ,
393+ tip_depth : f64 ,
394+ ) -> Self {
395+ // Anchors
396+ let top_anchor = center - DVec2 :: new ( 0. , radius * cleft_depth) ;
397+ let bottom_anchor = center + DVec2 :: new ( 0. , radius * tip_depth) ;
398+
399+ let side_x = radius;
400+ // Offset is for less squat shape (-0.25).
401+ let right_anchor = DVec2 :: new (
402+ center. x + side_x * ( 1. + right_bulb_expand) ,
403+ ( center. y + radius * ( right_bulb_height - 0.25 ) ) * ( 1. + right_bulb_expand) - center. y * right_bulb_expand,
404+ ) ;
405+ let left_anchor = DVec2 :: new (
406+ center. x - side_x * ( 1. + left_bulb_expand) ,
407+ ( center. y + radius * ( left_bulb_height - 0.25 ) ) * ( 1. + left_bulb_expand) - center. y * left_bulb_expand,
408+ ) ;
409+
410+ // Handle Directions
411+ let ( top_sin, top_cos) = cleft_angle. sin_cos ( ) ;
412+ let top_dir = DVec2 :: new ( top_sin, -top_cos) * radius * 0.5 ;
413+
414+ let ( bot_sin, bot_cos) = tip_angle. sin_cos ( ) ;
415+ let bot_dir = DVec2 :: new ( bot_sin, -bot_cos) * radius * 0.45 ;
416+
417+ // Side Tangents
418+ let side_up = DVec2 :: new ( 0. , -radius * 0.4 ) ;
419+ let side_down = DVec2 :: new ( 0. , radius * 0.5 ) ;
420+
421+ let manipulator_groups = vec ! [
422+ ManipulatorGroup :: new( top_anchor, Some ( top_anchor + DVec2 :: new( -top_dir. x, top_dir. y) ) , Some ( top_anchor + top_dir) ) ,
423+ ManipulatorGroup :: new( right_anchor, Some ( right_anchor + side_up) , Some ( right_anchor + side_down) ) ,
424+ ManipulatorGroup :: new( bottom_anchor, Some ( bottom_anchor + bot_dir) , Some ( bottom_anchor + DVec2 :: new( -bot_dir. x, bot_dir. y) ) ) ,
425+ ManipulatorGroup :: new( left_anchor, Some ( left_anchor + side_down) , Some ( left_anchor + side_up) ) ,
426+ ] ;
427+
428+ Self :: new ( manipulator_groups, true )
429+ }
382430}
383431
384432pub fn calculate_b ( a : f64 , turns : f64 , outer_radius : f64 , spiral_type : SpiralType ) -> f64 {
0 commit comments