一条直线可以通过函数 y = mx + b 定义,其中 x 和 y 是笛卡尔平面上的坐标,m 是由 (y2 - y1)/( 定义的直线的斜率x2 - x1),b 是直线与 y 轴的交点。
给定该信息和线上的两个点,您可以用一些基本代数来填充空白,以确定定义该线的函数。请注意,如果图像的坐标平面将 (0, 0) 放在左上角,则可能需要翻转 y 坐标的符号。
A line can be defined by the function y = mx + b where x and y are coordinates on the cartesian plane, m is the slope of the line defined by (y2 - y1)/(x2 - x1), and b is the point where the line intersects the y-axis.
Given that information and two points on the line, you can fill in the blanks with some basic algebra to determine a function that defines the line. Note that if your coordinate plane for the image places (0, 0) in the top left corner, you may have to flip the sign of the y-coordinate.
发布评论
评论(3)
是的。
假设 (x0,y0) 和 (x1,y1) 是直线上的起点和终点。
t*(x0,y0) + (t-1)*(x1,y1) 也将是该线上的点,其中 t 的范围从 0 到 1。
注意:
如果 t = 0,则得到 (x0,y0)
如果 t = 1,则得到 (x1,y1)
如果 t 是 (0,1) 内的任何值,则得到从 (x0,y0) 到 (x1,y1) 的“百分比”
(如果 t = 0.5,则位于两点之间的中间)
这就是计算机图形学中通常所说的“补间”
yes.
suppose (x0,y0) and (x1,y1) are the starting and ending points on the line.
t*(x0,y0) + (t-1)*(x1,y1) are also going to be points on that line where t ranges from 0 to 1.
note:
if t = 0, you get (x0,y0)
if t = 1, you get (x1,y1)
if t is any value inside (0,1) you get that "percentage" of the way from (x0,y0) to (x1,y1)
(if t = 0.5, you are halfway between the points)
this is what is often called "tweening" in computer graphics
是的。您的线段可以用以下方程描述:
其中,t 可以取 0 到 1 之间的任何值。
因此,要获得线上的随机点,只需为 t 选择一个随机值(0 到 1 之间),然后计算x,y 是。
这个想法是,x 从 39 行进到 75,而 y 从 75 行进到 142,t 代表已完成的行进部分。
Yes. Your line segment can be described by this equation:
where, t can take on any value between 0 and 1.
So, to get random points on the line, just choose a random value for t (between 0 and 1), and calculate what x, y are.
The idea is, x is traveling from 39 to 75, while y is traveling from 75 to 142, and t represents the fraction of travel that has been completed.
一条直线可以通过函数 y = mx + b 定义,其中 x 和 y 是笛卡尔平面上的坐标,m 是由
(y2 - y1)/( 定义的直线的斜率x2 - x1)
,b 是直线与 y 轴的交点。给定该信息和线上的两个点,您可以用一些基本代数来填充空白,以确定定义该线的函数。请注意,如果图像的坐标平面将 (0, 0) 放在左上角,则可能需要翻转 y 坐标的符号。
A line can be defined by the function
y = mx + b
where x and y are coordinates on the cartesian plane, m is the slope of the line defined by(y2 - y1)/(x2 - x1)
, and b is the point where the line intersects the y-axis.Given that information and two points on the line, you can fill in the blanks with some basic algebra to determine a function that defines the line. Note that if your coordinate plane for the image places (0, 0) in the top left corner, you may have to flip the sign of the y-coordinate.