9
$\begingroup$

I was searching for a way to determine if a point is within a polygon and stumbled upon rm -rf's answer. (actually, I really wanted to find a point within a Rectangle, but I won't be picky.)

The use of an undocumented function left me wondering about other possible functions that might be fun to play with. A look at

?Graphics`Mesh`*

Comes up with a number of functions that don't look like they have documentation. There has been some discussion on how to find undocumented options, but I'm wondering how to find out usage for undocumented functions. For example, CurveToPolygon looks like it could be fun to play with but I have no idea what values to pass to it.

Information[Graphics`Mesh`CurveToPolygon]

Tells me something about the options and attributes, but if I try any of the following:

Graphics`Mesh`CurveToPolygon[
 BezierCurve[{{-1, 0}, {-1, 2}, {1, 2}, {1, 0}}]]
Graphics`Mesh`CurveToPolygon[{{-1, 0}, {-1, 2}, {1, 2}, {1, 0}}]
Graphics`Mesh`CurveToPolygon[BezierCurve, {{-1, 0}, {-1, 2}, {1, 
   2}, {1, 0}}]
Graphics`Mesh`CurveToPolygon[{{-1, 0}, {-1, 2}, {1, 2}, {1, 
   0}}, BezierCurve]

The best I can learn is that the function takes 2 arguments.

I'm interested in knowing if there are ways to get at this information a priori or do I need to simply hang out with people who already know the answer?

Edit to address rm -rf comment I cut and pasted the code in Simon's answer into a new package, executed it, and when running:

Spelunk[Graphics`Mesh`CurveToPolygon]

I get the following output:

Mathematica graphics

which is different from what I think is expected?

CurveToPolygon[Curve[data_], o : OptionsPattern[]] /; validPoly[data] ...?

$\endgroup$
15
  • 2
    $\begingroup$ You don't really need to hang out with people. It's generally enough to chat with physicists, mathematicians, biologists, chemists and the such. OK, OK. I'll delete this comment at the first account suspension threat. $\endgroup$ Sep 23, 2013 at 2:18
  • $\begingroup$ @belisarius I don't know what that was, but I like the idea of threatening you with suspension... :D $\endgroup$
    – rm -rf
    Sep 23, 2013 at 2:21
  • 2
    $\begingroup$ btw, I would consider this a duplicate of What is the most convenient way to read definitions of in-memory symbols when we don't have the source files?. Simon's answer there is fantastic, and all you need to look at the definition of CurveToPolygon. If you do that, you'll see that it only takes one argument (and options), which must have the head Curve. $\endgroup$
    – rm -rf
    Sep 23, 2013 at 2:25
  • 2
    $\begingroup$ @belisarius it took me way too long to realize why I should be offended by that comment $\endgroup$ Sep 23, 2013 at 11:25
  • 1
    $\begingroup$ @bobthechemist You shouldn't. It was mostly a self-offense :) $\endgroup$ Sep 23, 2013 at 11:29

0