Message Boards Message Boards

Walking tracks graphics with AnglePath

enter image description here

POSTED BY: Bowen Ping
3 Replies

Hi Bowen,

Nice! Thanks for sharing. One minor suggestion, rather than

Apply[Sequence, # -> OptionValue[#] & /@ Options[Line][[All, 1]]]

consider using FilterRules. The more common way of handling options is like this

ClearAll@walker;
Options[walker] = Join[Options@Line, Options@Graphics];
walker[afunc_, range_List, opts : OptionsPattern[]] :=
  Graphics[
   Line[AnglePath[afunc /@ Range @@ range],
    Sequence @@ FilterRules[{opts}, Options[Line]]],
   Sequence @@ FilterRules[{opts}, Options[Graphics]]];
POSTED BY: Rohit Namjoshi

Hi Rohit,

Thanks for your suggestion! I didn't know the function FilterRules. That seems better. I will improve my code with it.

Best regards,

Bowen Ping

POSTED BY: Bowen Ping

enter image description here -- you have earned Featured Contributor Badge enter image description here Your exceptional post has been selected for our editorial column Staff Picks http://wolfr.am/StaffPicks and Your Profile is now distinguished by a Featured Contributor Badge and is displayed on the Featured Contributor Board. Thank you!

POSTED BY: Moderation Team
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract