Skip to main content
19-Tanzanite
Aug 1, 2023 12:24 PM UTC
Solved

How to draw rectangle and triangle from dots?

Hello,

1. Given the below points: (x1,y1), (x1,y2), (x2,y1), (x2,y2), how to make a rectangle in Mathcad Prime based on this points?

Cornel_0-1690892356799.png

 

2. Given the below points: (x1,y1), (x2,y1), (x3,y2), how to make a triangle in Mathcad Prime based on this points?

 

Cornel_1-1690892453947.png

 

LucMeekesAnswer
23-Emerald V
Aug 1, 2023 12:39 PM UTC

You can do both with this simple function:

LucMeekes_0-1690893428181.png

where pl is a nx2 matrix of (x,y) points. Examples:

LucMeekes_1-1690893479123.png

LucMeekes_2-1690893487306.png

LucMeekes_3-1690893515589.png

Success!
Luc

6 replies

LucMeekes23-Emerald VAnswer
23-Emerald V
Aug 1, 2023 12:39 PM UTC

You can do both with this simple function:

LucMeekes_0-1690893428181.png

where pl is a nx2 matrix of (x,y) points. Examples:

LucMeekes_1-1690893479123.png

LucMeekes_2-1690893487306.png

LucMeekes_3-1690893515589.png

Success!
Luc

Translate
Cornel19-TanzaniteAuthor
19-Tanzanite
Aug 1, 2023 1:06 PM UTC

Is it possible also to put some colour inside the square/rectangle?

Cornel_0-1690895148677.png

 

Translate
23-Emerald V
Aug 1, 2023 1:07 PM UTC

Sure, refer to the other thread on colour filling.

 

Success!

Luc

Translate
ttokoro
21-Topaz I
Aug 1, 2023 1:24 PM UTC

image.pngimage.pngimage.pngimage.pngimage.pngimage.png

Translate
t.t.
ttokoro
21-Topaz I
Aug 1, 2023 1:27 PM UTC

image.pngimage.png

 

image.pngimage.png

This is only p1=[3,1],p2=[5,7],p3=[7,1] type.

Translate
t.t.
ttokoro
21-Topaz I
Aug 2, 2023 5:46 AM UTC

image.pngimage.pngimage.pngimage.png

Translate
t.t.