좋아, 나는 VBA6을 알고 있지만, 당신이 말한 이후로하지 않습니다
I don't think it matters what I do it in
내가 좌표는 원의 중심을 가진 포함하는 일반적인 솔루션를 제공하고, 선 종점.
이 줄
는 벡터로 취급 할 수 있습니다
(line.x2-line.x1, line.y2-line.y1)
당신은 그냥 벡터 중임 프로그램이나 어떤이를 작성할 필요가 없습니다.
당신은 벡터의 크기를 얻을 수 있으며 변수에 할당 할 필요가 무엇 :
unitSize = sqrt((line.x2-line.x1)^2 + (line.y2-line.y1)^2)
이제
단위 벡터의 구성 요소로 그것을 확인하고 별도의 구성 요소를 얻을 :
unitX = (line.x2-line.x1)/unitSize
unitY = (line.y2-line.y1)/unitSize
을 이제 서클을 업데이트하는 방법 :
do {
circle.x = circle.x + unitX * incrementSize //incrementSize scales how big the movement is assign it to whatever you seem fit.
circle.y = circle.y + unitY * incrementSize
until (circle.x >= line.x2) //Or <= line.x2 depends which way you are going.
잘하면이 도움이됩니다.
은 (http://stackoverflow.com/questions/8073590/vb6-how-to-use-a-line-as-a-path) 두 번 [같은 질문]를 게시하지 마십시오. – Deanna