Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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}}]
share|improve this question
    
Greetings! Make the most of Mma.SE and take the tour now. Help us to help you, write an excellent question. Edit if improvable, show due diligence, give brief context, include minimal working examples of code and data in formatted form. As you receive give back, vote and answer questions, keep the site useful, be kind, correct mistakes and share what you have learned. – rhermans Feb 16 at 17:38
    
Hi rhermans....I believe the question is in expected format. I was unable to add the image of the printed curves as I was unable to copy them.please advise if i can add something to make it more understandable.Thanks – kranthi kumar Feb 16 at 17:46
    
It is now, after I formated it. – rhermans Feb 16 at 17:54
1  
There are things to do after your question is answered. It's a good idea to stay vigilant for some time, better approaches may come later improving over previous replies. Experienced users may point alternatives, caveats or limitations. New users should test answers before voting and wait 24 hours before accepting the best one. Participation is essential for the site, please come back to do your part tomorrow – rhermans Feb 16 at 17:54
    
Yes...I have tested it and voted it as answer...as i was expecting something like this exactly – kranthi kumar Feb 16 at 17:57
up vote 12 down vote accepted
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

share|improve this answer
    
Hi March...Amazing...it Worked..!! Thanks a ton.. :D – kranthi kumar Feb 16 at 17:49
    
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? – kranthi kumar Feb 16 at 20:33
Graphics[
 {
  Yellow,
  FilledCurve@{
    BSplineCurve[
     Join[pts1, Reverse@pts2]
     , SplineClosed -> True
     ]
    }
  }
 ]

Mathematica graphics

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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