IOS作圖畫三角形,ios圖畫三角形
IOS作圖畫三角形by 伍雪穎
const CGFloat *color=CGColorGetComponents(popUpColor.CGColor);UIGraphicsBeginImageContext(CGSizeMake(30, 20));CGContextRef ctx = UIGraphicsGetCurrentContext();CGContextSetRGBFillColor(ctx, color[0], color[1], color[2], 1);CGContextSetShadowWithColor(ctx, CGSizeMake(0, 0), 7.0, [UIColor blackColor].CGColor);CGPoint points[3] = { CGPointMake(15, 20), CGPointMake(25, 0), CGPointMake(5,0)};CGContextAddLines(ctx, points, 3);CGContextClosePath(ctx);CGContextFillPath(ctx);UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();UIGraphicsEndImageContext();
iOS怎使用程式畫三角形?
這段代碼能夠實現:-(void)drawRect:(CGRect)rect{ CGContextRef ctx = UIGraphicsGetCurrentContext(); CGContextBeginPath(ctx); CGContextMoveToPoint (ctx, CGRectGetMinX(rect), CGRectGetMinY(rect)); // top left CGContextAddLineToPoint(ctx, CGRectGetMaxX(rect), CGRectGetMidY(rect)); // mid right CGContextAddLineToPoint(ctx, CGRectGetMinX(rect), CGRectGetMaxY(rect)); // bottom left CGContextClosePath(ctx); CGContextSetRGBFillColor(ctx, 1, 1, 0, 1); CGContextFillPath(ctx);} 到DEVDIV.COM網站查看回答詳情>>
怎用尺規作圖畫三角形的中線與高
某一條邊的中線畫法:以這條邊的一端為圓心,長度為半徑,畫個圓弧
以這條邊的另一端為圓心,長度為半徑,再畫個圓弧,
可以得到圓弧的兩個交點,串連兩個中點,就是這條邊的垂直平分線。
這條邊的中點也就找到了,串連中點和三角形的另一個點就是中線了
高的畫法:,三角形ABC中,AC<AB,以A為圓心,AC為半徑,作圓弧,交BC於D
作CD的垂直平分線,就是BC邊的高