查找科赫曲线的坐标 [英] Finding coordinates of Koch Curve
问题描述
对不起,我的语言,因为英语是我的第二语言.
Sorry for my language since English is my second language.
我正在尝试将直线转换为称为科赫曲线的分形.给出了直线的2个点,然后我需要创建Koch曲线,在该曲线中将线划分为3个线段,然后使第二个线段成为等边三角形.参见 http://www.tgmdev.be/curvevonkoch.php .
I am trying to convert a straight line into a fractal known as Koch curve. The 2 points of the straight line are given and then I need to create the Koch curve where I divide the line to 3 segments and then make the second segment an equilateral triangle. See http://www.tgmdev.be/curvevonkoch.php.
到目前为止,我们将直线转换为4个相等的线段,我需要找出科赫曲线的所有坐标.
So far we convert the straight line to 4 equally segments, and I need to figure out all the coordinates of the Koch curve.
当2点的y坐标相同时,我想到一条直线,这给了我水平线.如果是这样,我可以通过将第二段除以一半并取直角三角形的cos(60)来找出等边三角形的3个点.如这里: http://www.themathpage.com/atrig/30-60-90-triangle.htm
I have thought of a straight line when the y coordinates of the 2 point are the same which give me horizontal line. if so, I can figure out the 3 points of equilateral triangle by dividing the second segment half and taking the cos(60) of the right triangle. as here: http://www.themathpage.com/atrig/30-60-90-triangle.htm
我的问题是当直线是对角线时如何查找所有坐标,例如a(200,100),b(400,600)或a(400,500),b(100,500).
My problem is how to find all coordinates when the stright line is diagonal, for example a(200,100), b(400,600) or a(400,500), b(100,500).
推荐答案
如果您的基本段是AB,且A(Ax,Ay)和B(Bx,By),则这4个子段将是如下定义的AP,PQ,QR,RB.
If your base segment is AB, with A(Ax,Ay) and B(Bx,By), then the 4 sub-segments will be AP, PQ, QR, RB as defined below.
首先定义两个相同长度的正交向量:
First define two orthogonal vectors of same length:
U(Bx-Ax,By-Ay) and
V(Ay-By,Bx-Ax)
然后要点:
P=A+(1/3)*U
Q=A+(1/2)*U+(sqrt(3)/6)*V
R=A+(2/3)*U
point + vector = point表示法类似于翻译.
The point+vector=point notation is similar to a translation.
具有A(100,100)和B(400,100)的示例:
Example with A(100,100) and B(400,100):
U(300,0)
V(0,300)
P = (100,100) + (1/3)*(300,0) = (200,100)
Q = (100,100) + (1/2)*(300,0) + (sqrt(3)/6)*(0,300) = (250,186)
R = (100,100) + (2/3)*(300,0) = (300,100)
这篇关于查找科赫曲线的坐标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!