Skip to content

How to position shapes (triangle) #1308

Answered by TonyCrane
vavu786 asked this question in Q&A
Discussion options

You must be logged in to vote

Sorry to respond so late.
Is this what you want?

The best way to do this is to use align_to method:

triangle_small.align_to(triangle_big, DL)

and you can also use next_to or shift:

triangle_small.next_to(triangle_big.get_vertices()[1], aligned_edge=DL, buff=0)
triangle_small.shift(triangle_big.get_vertices()[1] - triangle_small.get_vertices()[1])

get_vertices method get the vertices (a list of points) of the triangle, and the indexes of the list of vertices are:

So the vertice in the lower left corner is triangle.get_vertices()[1].
And you can also directly put the small triangle to the target position by using the about_point parameter of scale:

triangle_small.scale(0.5, about_point=tr…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@vavu786
Comment options

@3b1b
Comment options

3b1b Feb 4, 2021
Maintainer

Answer selected by TonyCrane
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants