TITLE: understanding if a point is inside or outside a Koch fractal curve
QUESTION [5 upvotes]: I continue this post because i have a problem: understand if a point is inside or outside a Koch curve.
I can find the third point of a equilateral triangle (and i need it for build a koch curve) but i have 2 solution: now i have to decide which one is the best (the one that is outside the koch curve)!
this figure explain better:

the little equilateral triangle in the red circles have the wrong direction.
Some ideas?

REPLY [2 votes]: (Assuming this is related to programming, as the link indicates.)
If you give each segment a consistent orientation (just a choice of ordering on the two endpoints), then you will always be able to tell 'inside' from 'outside'. For example, suppose I have a segment oriented ($a$, $b$), where $a$ and $b$ are endpoints.  Then I want to introduce trisecting points $a'$ and $b'$ (so the order I have in mind is $a$, $a'$, $b'$, $b$), then I choose $c$ not on the segment so that $a'c$ has the same length as $b'c$.  Of course there are two such points $c$ (hence the question, right?).  Let $\mathbf{u} = \vec{ab}$ and $\mathbf{v} = \vec{ac}$.  We must choose $c$ so that the acute angle between $\mathbf{u}$ and $\mathbf{v}$ is swept out from $\mathbf{u}$ to $\mathbf{v}$ in a counterclockwise direction.  One way to do this is to consider $\mathbf{u}, \mathbf{v}$ as 3-dimensional vectors with 0 component in the $z$ direction.  Then take the cross product $\mathbf{u} \times \mathbf{v}$.  If the result has a positive $z$-component, then the choice of $c$ was correct, while if it is negative, then other choice of $c$ was incorrect -- choose the other one.  Note, since both $\mathbf{u}, \mathbf{v}$ live on the $xy$-plane, their cross product will only have a $z$-component.  Also note, it is essential to know the order of $a$ and $b$ for this to work.  To prepare for the next iteration, orient the new segments thus: $(a, a'), (a', c), (c, b'), (b', b)$.
Hope this helps!