#🔒 Basic numpy arrays with triangles

4 messages · Page 1 of 1 (latest)

obsidian oxide
#

https://paste.pythondiscord.com/4BUA
Im trying to use numpy to create a polygon splitting algorithm that works like so:

  1. Rectangle
  2. For each side of the shape:
    take the midpoint of the ab edge
    extend the midpoint perpendicularly
    draw triangle from 3 points
  3. Recurse until reached set recursion depth

My problem is that this is my first time using numpy and i find the dimension stuff super confusing, id love for someone to explain it to me based on what i already have written and this problem.

The error im getting now is in the pastebin, but i think the entire way im doing this has to be refactored i just dont know how.

Also the algorithm is flawed right now in terms of the math but i can change that myself after i understand how this triangle array should be done

py5 is a drawing library, the triangle function in it takes 3 xy points as arguments:
triangle(x1: float, y1: float, x2: float, y2: float, x3: float, y3: float, /) -> None

crisp plankBOT
#

@obsidian oxide

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

crisp plankBOT
#

@obsidian oxide

Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.