cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

Undocumented function Polygon

LucMeekes
23-Emerald III

Undocumented function Polygon

Stumbled across this function in Mathcad 11, don't know if it exists in other versions:

Symbolically it does:

Does anybody have any idea what the matrix should contain?

Especially intriguing is the fact that it should be a matrix of either 3, 6 or 7 rows.

Luc

13 REPLIES 13
-MFra-
21-Topaz II
(To:LucMeekes)

In mathcad 15 does not exist. There is, however, Polyhedron but it is another thing ...

as you can see from the following image:

polyhedra.jpg

Luc,

Can you attach MC11 worksheet? And more: plottools - Maple Programming Help

LucMeekes
23-Emerald III
(To:VladimirN)

Sure,

here she is.

I had a look at the Maple plottools, but the infomation there doesn't seem to fit, so far.

Luc

LucMeekes wrote:

...

I had a look at the Maple plottools, but the infomation there doesn't seem to fit, so far.

Luc

Yes, in this case, for some reason, there is a restriction on the size of the matrix.

LucMeekes
23-Emerald III
(To:LucMeekes)

Found how to use it. It works only in plotting. Here's an example:

LucMeekes
23-Emerald III
(To:LucMeekes)

With a bit of further experimenting I found that the first three rows of the matrix that goes into the Polygon function contain the X, Y and Z-coordinates of the polygon points respectively. Further rows determine colour or the polygon.

Here are three examples:

And their results are:

The black (tilted w.r.t. the X/Y plane) triangle is associated with L3, the red/blue/green triangle is L6 (the subsequent rows of the matrix determine the values of red, blue and green on the respective points on a scale from 0 to 1 (any value above 1 or below 0 is discarded). The third triangle uses a 4-valued colour that I haven't figured out yet; I've set the display to fill the polygon with smooth shading.

There also exists a Polyline function, that just draws a line from point to point, but the order of coordinates is unusual: Y,Z and then X. And it doesn't work with the four-valued colour (L7). The other two shapes from the same matrices above become:

Luc

LucMeekes
23-Emerald III
(To:LucMeekes)

With a function polygon()

and PolyLine() that uses Polyline after rearranging the X,Y and Z-coordinates

I can now draw pentagons:

The polyline (incomplete) pentagon sits on level z=0, the full pentagon sits on level z=1.

Luc

Not in 15.  Not in Prime.

There was a switch from Maple to SciTech half way through the 13 releases.  Perhaps it is coming from Maple.

LucMeekes
23-Emerald III
(To:LucMeekes)

And now there appears to also exist a function Points() in Mathcad 11. It appears to be related to plotting as well.

 

Luc

And how does it look in MC11?

LucMeekes
23-Emerald III
(To:VladimirN)

So far, I've tried only this:

LM_20171130_Points.png

All (3) errors are the same. Apparently the function requires vector(s) with (at least?) 3 elements.

The "untranslatable" is an indication that the function just wants to plot, it doesn't want to output numerical information; much like Polygon and Polyline.

 

Luc

Yes, you forgot about the plot.

LucMeekes
23-Emerald III
(To:LucMeekes)

Ok. A little further experimentation reveals:

The argument to the points function is a matrix, where each column defines a point by, from top to bottom: x,z,y,R,B,G coordinates and colour value. The default colour is black, so the matrix can have 3 or 6 rows.

Here's a usage example:

LM_20171130_PointsSphere.png

 

Luc

Announcements

Top Tags