如何获得一条画线的所有点

时间:2019-04-02 12:43:53

标签: java

如果我画一条线

FROM base AS containerd
RUN apt-get update && apt-get install -y btrfs-tools
ENV INSTALL_BINARY_NAME=containerd
COPY hack/dockerfile/install/install.sh ./install.sh
COPY hack/dockerfile/install/$INSTALL_BINARY_NAME.installer ./
RUN PREFIX=/build/ ./install.sh $INSTALL_BINARY_NAME

FROM runtime-dev AS runc
ENV INSTALL_BINARY_NAME=runc
COPY hack/dockerfile/install/install.sh ./install.sh
COPY hack/dockerfile/install/$INSTALL_BINARY_NAME.installer ./
RUN PREFIX=/build/ ./install.sh $INSTALL_BINARY_NAME

如何仅知道起点和终点就知道组成这条线的像素的坐标?

1 个答案:

答案 0 :(得分:0)

我建议使用基本数学。因为线上有无限个点,所以无法用所有点填充数组。可能是:

g.drawLine(0, 1, 10, 20);

public double line1(int x){
  return (1+x*2)
}