5
$\begingroup$

I am trying to fill the space between two curves (curve1 and curve2) I generated since long but unable to do so. Can some one help on this please. The following is the code snippet.

pts1 = {{55.78, 57}, {23.03, 63.18}, {2.3, 59.21}, {0, 46.85}, {0, 
    35.18}, {28.57, 35.03}, {49.39, 35.03}, {62.19, 24.39}, {52.4, 
    7.4}, {29, 9}, {0, 10}};

curve1 = Graphics[{Thick, BSplineCurve[pts1], Green, Line[pts1], Red, 
   Point[pts1]}]
pts2 = {{55.78, 50}, {23.03, 56.18}, {7.3, 54.21}, {7, 46.85}, {5.0, 
    40.18}, {28.57, 42.03}, {55.56, 38.50}, {69.19, 24.39}, {57.4, 
    2.4}, {29, 2}, {0.5, 3}};
curve2 = Graphics[{Thick, BSplineCurve[pts2], Green, Line[pts2], Red, 
   Point[pts2]}]
pts3 = {{55.78, 57}, {55.78, 50}};
pts4 = {{0, 10}, {0.5, 3}};
curve3 = Graphics[{Thick, BSplineCurve[pts3], Green, Line[pts3], Red, 
   Point[pts3]}]
curve4 = Graphics[{Thick, BSplineCurve[pts4], Green, Line[pts4], Red, 
   Point[pts4]}]
Show[curve1, curve2, curve3, curve4, 
 Filling -> {{{1} -> {2}}, {Yellow}}]
$\endgroup$
12
$\begingroup$
Graphics[{
   Yellow, FilledCurve[{BSplineCurve /@ {pts1, pts4, Reverse@pts2, pts3}}],
   Green, Line[Join[pts1, pts4, Reverse@pts2, pts3]],
   Red, Point[Join[pts1, pts2, pts3, pts4]]
  }]

enter image description here

$\endgroup$
  • $\begingroup$ Hi March...Amazing...it Worked..!! Thanks a ton.. :D $\endgroup$ – kranthi kumar Feb 16 '16 at 17:49
  • $\begingroup$ Is there any place to get a better S and other alphabets....I am looking for a better shape...or is it only on trial and error basis we figure out the points? $\endgroup$ – kranthi kumar Feb 16 '16 at 20:33
6
$\begingroup$
Graphics[
 {
  Yellow,
  FilledCurve@{
    BSplineCurve[
     Join[pts1, Reverse@pts2]
     , SplineClosed -> True
     ]
    }
  }
 ]

Mathematica graphics

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.