网页资讯视频图片知道文库贴吧地图采购
进入贴吧全吧搜索

 
 
 
日一二三四五六
       
       
       
       
       
       

签到排名:今日本吧第个签到,

本吧因你更精彩,明天继续来努力!

本吧签到人数:0

一键签到
成为超级会员,使用一键签到
一键签到
本月漏签0次!
0
成为超级会员,赠送8张补签卡
如何使用?
点击日历上漏签日期,即可进行补签。
连续签到:天  累计签到:天
0
超级会员单次开通12个月以上,赠送连续签到卡3张
使用连续签到卡
05月14日漏签0天
easyx吧 关注:10,932贴子:46,963
  • 看贴

  • 图片

  • 吧主推荐

  • 游戏

  • 4回复贴,共1页
<<返回easyx吧
>0< 加载中...

用ezsyx画兔子

  • 只看楼主
  • 收藏

  • 回复
  • 岸边露畔
  • 幼儿园
    2
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
刚开始学图形学的时候来这个吧看看有没有能作为作业抄的代码,现在学了点皮毛也能画出个可以看的,一楼附上源码


  • 岸边露畔
  • 幼儿园
    2
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
#include "stdafx.h"
#include <iostream>
#include <graphics.h> // 包含 EasyX 头文件
#include<conio.h>
using namespace std;
struct Point {
float x;
float y;
};
// 计算贝塞尔曲线上的点
Point calculateBezierPoint(Point start, Point control1, Point control2, Point end, float t) {
Point result;
result.x = pow(1 - t, 3) * start.x + 3 * pow(1 - t, 2) * t * control1.x + 3 * (1 - t) * pow(t, 2) * control2.x + pow(t, 3) * end.x;
result.y = pow(1 - t, 3) * start.y + 3 * pow(1 - t, 2) * t * control1.y + 3 * (1 - t) * pow(t, 2) * control2.y + pow(t, 3) * end.y;
return result;
}
// 绘制贝塞尔曲线
void drawBezierCurve(Point start, Point control1, Point control2, Point end, int numPoints) {
Point prevPoint = start;
for (int i = 1; i <= numPoints; ++i) {
float t = static_cast<float>(i) / numPoints;
Point p = calculateBezierPoint(start, control1, control2, end, t);
line(static_cast<int>(prevPoint.x), static_cast<int>(prevPoint.y),
static_cast<int>(p.x), static_cast<int>(p.y)); // 绘制从前一个点到当前点的直线段
prevPoint = p;
}
}
void ear1()
{
setlinecolor(RGB(80,42,33));
setlinestyle(PS_SOLID, 5); // 设置线条样式为实线,线宽为3
Point start = {200, 354};
Point control1 = {133,280}; // 第一个控制点
Point control2 = {84,185}; // 第二个控制点
Point end = {89,99};
int numPoints = 100; // 指定绘制曲线的精度,即分成多少段
Point start1 = {194,79};
Point control11 = {213,96};
Point control22 = {252,212};
Point end1 = {255,314};
Point start11 = {89,99};
Point control111 = {120,62};
Point control222 = {140,57};
Point end11 = {194,79};
cleardevice(); // 清屏
drawBezierCurve(start, control1, control2, end, numPoints); // 绘制贝塞尔曲线
drawBezierCurve(start1, control11, control22, end1, numPoints);
drawBezierCurve(start11, control111, control222, end11, numPoints);
}
void ear2()
{
setlinecolor(RGB(80,42,33));
setlinestyle(PS_SOLID, 5); // 设置线条样式为实线,线宽为3
Point start = {349,299};
Point control1 = {322,185};
Point control2 = {314,114};
Point end = {317,55};
int numPoints = 100; // 指定绘制曲线的精度,即分成多少段
Point start1 = {317,55};
Point control11 = {337,29};
Point control22 = {394,31};
Point end1 = {440,74};
Point start11 = {440,74};
Point control111 = {451,114};
Point control222 = {430,244};
Point end11 = {403,310};
drawBezierCurve(start, control1, control2, end, numPoints); // 绘制贝塞尔曲线
drawBezierCurve(start1, control11, control22, end1, numPoints);
drawBezierCurve(start11, control111, control222, end11, numPoints);
}
void Cochlea1()
{
setlinecolor(RGB(255,131,121));
setlinestyle(PS_SOLID, 5); // 设置线条样式为实线,线宽为3
Point start = {209,344};
Point control1 = {185,315};
Point control2 = {133,231};
Point end = {117,171};
int numPoints = 100;
Point start1 = {117,171};
Point control11 = {122,149};
Point control22 = {142,127};
Point end1 = {179,126};
Point start11 = {179,126};
Point control111 = {205,150};
Point control222 = {233,248};
Point end11 = {239,323};
drawBezierCurve(start, control1, control2, end, numPoints); // 绘制贝塞尔曲线
drawBezierCurve(start1, control11, control22, end1, numPoints);
drawBezierCurve(start11, control111, control222, end11, numPoints);
}
void fillCochlea1()
{
// 设置填充颜色和线条样式
setfillcolor(RGB(255, 131, 121));
setlinecolor(RGB(255, 131, 121));
setlinestyle(PS_SOLID, 5);
// 定义顶点数组
POINT points[] = {
{209, 344},
{185, 315},
{133, 231},
{117, 171},
{117, 171},
{122, 149},
{142, 127},
{179, 126},
{179, 126},
{205, 150},
{233, 248},
{239, 323}
};
// 绘制多边形并填充
fillpolygon(points, sizeof(points) / sizeof(points[0]));
}
void Cochlea2()
{
setlinecolor(RGB(255,131,121));
setlinestyle(PS_SOLID, 5); // 设置线条样式为实线,线宽为3
Point start = {364,301};
Point control1 = {352,242};
Point control2 = {340,157};
Point end = {346,99};
int numPoints = 100; // 指定绘制曲线的精度,即分成多少段
Point start1 = {346,99};
Point control11 = {358,83};
Point control22 = {381,80};
Point end1 = {414,105};
Point start11 = {414,105};
Point control111 = {426,159}; // 第一个控制点
Point control222 = {416,224}; // 第二个控制点
Point end11 = {390,306};
drawBezierCurve(start, control1, control2, end, numPoints); // 绘制贝塞尔曲线
drawBezierCurve(start1, control11, control22, end1, numPoints);
drawBezierCurve(start11, control111, control222, end11, numPoints);
}
void fillCochlea2()
{
// 设置填充颜色和线条样式
setfillcolor(RGB(255, 131, 121));
setlinecolor(RGB(255, 131, 121));
setlinestyle(PS_SOLID, 5); // 设置线条样式为实线,线宽为5
// 定义顶点数组
POINT points[] = {
{364,301},
{352,242},
{340,157},
{346,99},
{358,83},
{381,80},
{414,105},
{426,159},
{416,224},
{390,306}
};
// 绘制多边形并填充
fillpolygon(points, sizeof(points) / sizeof(points[0]));
}


2025-05-14 09:32:58
广告
  • 岸边露畔
  • 幼儿园
    2
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
void head()
{
setlinecolor(RGB(80,42,33));
setlinestyle(PS_SOLID, 5);
//额头
Point start = {200,354};
Point control1 = {209,344};
Point control2 = {239,323};
Point end = {256,315};
int numPoints = 100;
Point start1 = {256,315};
Point control11 = {288,303};
Point control22 = {322,299};
Point end1 = {349,299};
Point start11 = {349,299};
Point control111 = {364,301};
Point control222 = {390,306};
Point end11 = {403,310};
//脸
Point a= {200,354};
Point b= {150,421};
Point c= {134,499};
Point d= {164,551};
Point aa= {403,310};
Point bb= {433,331};
Point cc= {471,378};
Point dd= {513,426};
Point a1= {513,426};
Point b1= {532,460};
Point c1= {534,507};
Point d1= {490,548};
line(260, 586, 401, 586);
drawBezierCurve(start, control1, control2, end, numPoints); // 绘制贝塞尔曲线
drawBezierCurve(start1, control11, control22, end1, numPoints);
drawBezierCurve(start11, control111, control222, end11, numPoints);
drawBezierCurve(a,b,c,d, numPoints);
drawBezierCurve(aa,bb,cc,dd, numPoints);
drawBezierCurve(a1,b1,c1,d1, numPoints);
}
void hand()
{
setlinecolor(RGB(80,42,33));
setlinestyle(PS_SOLID, 5); // 设置线条样式为实线,线宽为3
Point start = {164,551};
Point control1 = {146,573};
Point control2 = {143,589};
Point end = {153,601};
int numPoints = 100; // 指定绘制曲线的精度,即分成多少段
Point start1 = {153,601};
Point control11 = {188,611};
Point control22 = {244,602};
Point end1 = {260,586};
Point start11 = {260,586};
Point control111 = {250,558};
Point control222 = {206,543};
Point end11 = {164,551};
Point a= {401,586};
Point b= {404,575};
Point c= {457,545};
Point d= {490,548};
Point aa= {490,548};
Point bb= {505,560};
Point cc= {510,577};
Point dd= {503,592};
Point a1= {503,592};
Point b1= {432,611};
Point c1= {405,602};
Point d1= {401,586};
drawBezierCurve(start, control1, control2, end, numPoints); // 绘制贝塞尔曲线
drawBezierCurve(start1, control11, control22, end1, numPoints);
drawBezierCurve(start11, control111, control222, end11, numPoints);
drawBezierCurve(a,b,c,d, numPoints);
drawBezierCurve(aa,bb,cc,dd, numPoints);
drawBezierCurve(a1,b1,c1,d1, numPoints);
}
void eye()
{
setlinecolor(RGB(80,42,33));
setlinestyle(PS_SOLID, 5);
setfillcolor(RGB(80,42,33)); // 设置填充颜色为红色
fillcircle(272, 431, 22);
fillcircle(391,414, 22);
}
void nose()
{
setlinecolor(RGB(80,42,33));
setlinestyle(PS_SOLID, 5); // 设置线条样式为实线,线宽为3
Point start = {332,462};
Point control1 = {333,453};
Point control2 = {352,445};
Point end = {364,446};
int numPoints = 100; // 指定绘制曲线的精度,即分成多少段
Point start1 = {364,446};
Point control11 = {368,453};
Point control22 = {367,471};
Point end1 = {354,480};
Point start11 = {354,480};
Point control111 = {343,476};
Point control222 = {333,471};
Point end11 = {332,462};
Point a= {354,480};
Point b= {356,493};
Point c= {354,503};
Point d= {352,512};
Point aa= {352,512};
Point bb= {336,522};
Point cc= {320,521};
Point dd= {313,516};
Point a1= {352,512};
Point b1= {364,521};
Point c1= {381,518};
Point d1= {387,506};
drawBezierCurve(start, control1, control2, end, numPoints); // 绘制贝塞尔曲线
drawBezierCurve(start1, control11, control22, end1, numPoints);
drawBezierCurve(start11, control111, control222, end11, numPoints);
drawBezierCurve(a,b,c,d, numPoints);
drawBezierCurve(aa,bb,cc,dd, numPoints);
drawBezierCurve(a1,b1,c1,d1, numPoints);
}
void Blush()
{
setlinecolor(RGB(255,131,121));
setfillcolor(RGB(255,131,121));
fillellipse(424,451,513,502); // 在指定矩形内画一个填充椭圆
fillellipse(160,466, 251,514);
}
int main() {
initgraph(648, 648); // 初始化图形窗口
setbkcolor(WHITE); // 设置背景颜色为黑色
ear1();
ear2();
Cochlea1();
Cochlea2();
head();
hand();
eye();
nose();
Blush();
fillCochlea1();
fillCochlea2();
_getch(); // 等待用户按键退出
// closegraph(); // 关闭图形窗口
return 0;
}


  • yangw80
  • 初三年级
    12
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
效果真不错,有绘画天赋


  • ipwap
  • 学前班
    3
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
可爱


登录百度账号

扫二维码下载贴吧客户端

下载贴吧APP
看高清直播、视频!
  • 贴吧页面意见反馈
  • 违规贴吧举报反馈通道
  • 贴吧违规信息处理公示
  • 4回复贴,共1页
<<返回easyx吧
分享到:
©2025 Baidu贴吧协议|隐私政策|吧主制度|意见反馈|网络谣言警示