快来拿分吧,朋友(150分)

  • 主题发起人 主题发起人 hhh123
  • 开始时间 开始时间
H

hhh123

Unregistered / Unconfirmed
GUEST, unregistred user!
首先很诚挚地感谢您看这个问题,您的对一个菜鸟的帮助,将使我受益一生。
我的问题是:已知一圆曲线的夹角和半径,如何让DEPHI画出该圆曲线,我
查了很多质料,但都是讲数据库的多,这方面很少,期盼您的回答,谢谢。
或有没有好的控件或给我讲讲CANVAS的用法
 
这个呀,!呵!你用这个就好了!
canvas.Arc(w,x,y,z+2*(z-x),y,z,w,z) 里面这8位变量自己写个算法算一下好了,:)祝你好运
具体,你可以查帮助ARC的用法,我抄出来给你好了
Draws an arc on the image along the perimeter of the ellipse bounded by the specified rectangle.

procedure Arc(X1, Y1, X2, Y2, X3, Y3, X4, Y4: Integer);

Description

Use Arc to draw an elliptically curved line with the current Pen. The arc traverses the perimeter of an ellipse that is bounded by the points (X1,Y1) and (X2,Y2). The arc is drawn following the perimeter of the ellipse, counterclockwise, from the starting point to the ending point. The starting point is defined by the intersection of the ellipse and a line defined by the center of the ellipse and (X3,Y3). The ending point is defined by the intersection of the ellipse and a line defined by the center of the ellipse and (X4, Y4).

Note: On Windows 95, the sums X1 + X2 and Y1 + Y2 cannot exceed 32768. Also, the sum X1 + X2 + Y1 + Y2 cannot exceed 32768.

On NT, the drawing direction can be changed to clockwise using the Windows API call SetArcDirection.
 
楼上的说的完全正确,给他加分吧
 
//指定起止点及圆心作弧: 输入起止点(X1,Y1)、(X2,Y2)、参考点(X3,Y3)、圆心(X0,Y0),
//输出圆心角Angle(-360~360);若无法形成圆弧返回False, 否则返回True

function GetArcByCenter(X1, Y1, X2, Y2, X3, Y3, X0, Y0: Double; var Angle: Double): Boolean;
var
Clockwise0, Clockwise: Boolean;
begin
if (GetLineLength(X0, Y0, X1, Y1) > 0.00001)
and (GetLineLength(X0, Y0, X2, Y2) > 0.00001)
and (GetLineLength(X1, Y1, X2, Y2) > 0.00001)
and (GetLineLength(X2, Y2, X3, Y3) > 0.00001)
and (GetLineLength(X1, Y1, X3, Y3) > 0.00001) then
begin
//弧度
Angle := GetLineAngle(X0, Y0, X2, Y2) - GetLineAngle(X0, Y0, X1, Y1);
//圆心角顺时针?
Clockwise0 := IsClockwise(X1, Y1, X0, Y0, X2, Y2);
//参考点决定弧度
Clockwise := IsClockwise(X1, Y1, X3, Y3, X2, Y2);
//圆心与参考点不在起止点连线的同一侧时取小弧;反之,取大弧
if ((Clockwise0 = Clockwise) = (Abs(Angle) <= 180)) then
if Angle > 0 then
Angle := Angle - 360
else
Angle := 360 + Angle;
Result := True;
end
else
Result := False;
end;
 
天真兄弟,你能详细点吗?我如何将圆曲线的夹角和半径转化为
(w,x,y,z+2*(z-x),y,z,w,z)
 
楼上的已经给出完整答案了,偶来看看而已[:D][:D][:D]
 
OK,
如半径为100,角度为90,你就可以这样!
x1,y1,x2,y2是圆的外面那个矩形
因此,我就设
x1,y1=0
x2,y2=200
圆心是(100,100)
具体两个点x3,y3和x4,y4你自己算吧,因为我取了90度所以比较好算,
所以就是canvas.Arc(0,0,200,200,200,100,100,0)
(200,100)为画圆的起点,(100,0)为画圆的终点!逆时针:)
 
接受答案了.
 

Similar threads

回复
0
查看
863
不得闲
D
回复
0
查看
2K
DelphiTeacher的专栏
D
D
回复
0
查看
1K
DelphiTeacher的专栏
D
后退
顶部