Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Creating rounded blobs in Mathematica 8

  • To: mathgroup at smc.vnet.net
  • Subject: [mg114244] Creating rounded blobs in Mathematica 8
  • From: Yaroslav Bulatov <yaroslavvb at gmail.com>
  • Date: Sun, 28 Nov 2010 06:55:08 -0500 (EST)

I'd like to create translucent rounded blobs in Mathematica 8. Thick
lines do almost what I need, but I how can I fill the inside of the
blob?

Here's an example

obj = JoinedCurve[Line[{{0, 0}, {0, 1}, {1, 1}}], CurveClosed ->
True];
Graphics[{Blue, JoinForm["Round"], Opacity[.5],
AbsoluteThickness[40],obj}, ImageSize -> 200]

I've tried FilledCurve with thick EdgeForm for rounded edges, but it
changes color at the points where interior and edge overlap

obj1 = FilledCurve[Line[{{0, 0}, {0, 1}, {1, 1}}]];
Graphics[{Blue,
  EdgeForm[{JoinForm["Round"], AbsoluteThickness[40], Blue,
    Opacity[.5]}], Opacity[.5], ,
  obj1}, PlotRange -> {{-1/2, 3/2}, {-1/2, 3/2}}]

Another question:

JoinedCurve and FilledCurve need special treatment when points are
almost collinear. JoinedCurve with CurveClosed->True will have sharp
corners despite "Round" CapForm and JoinForm. What is a good way to
implement an approximate collinearity test for more than 3 points?

Example:

(* Need to detect that points are almost collinear and set CurveClosed-
>False *)
obj2 = JoinedCurve[Line[{{0, 0}, {0, 1}, {0.001, 2}}],
   CurveClosed -> True];
Graphics[{Blue, JoinForm["Round"], CapForm["Round"], Opacity[.5],
  AbsoluteThickness[40], obj2}, PlotRange -> {{-1/2, 1/2}, {-1, 3}}]

(* test of exact collinearity of 3 points *)
collinear[points_] :=Length[points] ==3 &&
(Det[Transpose[points]~Append~{1, 1, 1}] == 0)


----
Yaroslav
http://stackoverflow.com/users/419116/yaroslav-bulatov


  • Prev by Date: Re: Matrix Form of Quadratic Equations
  • Next by Date: Re: Documentation of Eigenvalues[], Eigensystem[]
  • Previous by thread: Re: how to recover a corrupted notebook?
  • Next by thread: How to short-circuit match failure?