情人节多种语言画玫瑰,总有一款适合你表白
bigegpt 2024-09-24 07:13 3 浏览
文章目录
- 小丑竟然是自己
- Python版本动态画玫瑰
- 代码
- 效果
- c语言画心形
- 代码
- matlab画3D玫瑰
- 代码
- 效果
- java画玫瑰线
- 代码
- 运行效果
- html动态玫瑰玫瑰
- 代码
- 效果
小丑竟然是自己
今天上午刚打完美赛,和另外两个队友一起奋斗了四天,最后一晚通宵,彻夜未眠,虽然很累,但看到写出一篇25页全英latex排版论文还是挺开心的。如果不得奖的话都打算退出建模圈了,比完赛看了一眼桌面右下角时间
还有两天就除夕了,还有五天就情人节了,emmm,我为什么要加一个就字,情人节好像和我还没啥关系。。。
但至少曾今还是有关系的,曾经有过两段感情,包括初恋,都是以我被分手告终,有时候想想是有点难过,可能的确是自己的原因吧,要么是自己性格的缺陷或者自己还不够足够优秀吧
大大小小也参加十多个各种比赛了,有个人的也有组队的,对于组队打比赛,遇到靠谱的队友一起合作,的确可以培养默契,认识许多新朋友,个人觉得很多人和大学同学不熟悉的原因主要是每个人的生活轨迹可能交集不是很多,如果多参加一些活动,不只是比赛,其实大学还是可以认识一些不错的朋友的,不过我认识的男同胞都是兄弟,本人目前各种取向还是正常的,O(∩_∩)O哈哈~
真心劝告还没有上大学的兄弟姐妹们上大学尽量选择男女比例稍微均衡的学校,要不就剩下和尚庙和尼姑庵了
但是大环境如果好了,也不要掉以轻心哈哈哈
下面是和某位不愿透露姓名的CSDN大佬的对话截图
既然情人节快到了,整理了几种画玫瑰线的代码,祝大家早日找到幸福的TA
Python版本动态画玫瑰
代码
import turtle
# 设置初始位置
turtle.penup()
turtle.left(90)
turtle.fd(200)
turtle.pendown()
turtle.right(90)
# 花蕊
turtle.fillcolor("red")
turtle.begin_fill()
turtle.circle(10, 180)
turtle.circle(25, 110)
turtle.left(50)
turtle.circle(60, 45)
turtle.circle(20, 170)
turtle.right(24)
turtle.fd(30)
turtle.left(10)
turtle.circle(30, 110)
turtle.fd(20)
turtle.left(40)
turtle.circle(90, 70)
turtle.circle(30, 150)
turtle.right(30)
turtle.fd(15)
turtle.circle(80, 90)
turtle.left(15)
turtle.fd(45)
turtle.right(165)
turtle.fd(20)
turtle.left(155)
turtle.circle(150, 80)
turtle.left(50)
turtle.circle(150, 90)
turtle.end_fill()
# 花瓣1
turtle.left(150)
turtle.circle(-90, 70)
turtle.left(20)
turtle.circle(75, 105)
turtle.setheading(60)
turtle.circle(80, 98)
turtle.circle(-90, 40)
# 花瓣2
turtle.left(180)
turtle.circle(90, 40)
turtle.circle(-80, 98)
turtle.setheading(-83)
# 叶子1
turtle.fd(30)
turtle.left(90)
turtle.fd(25)
turtle.left(45)
turtle.fillcolor("green")
turtle.begin_fill()
turtle.circle(-80, 90)
turtle.right(90)
turtle.circle(-80, 90)
turtle.end_fill()
turtle.right(135)
turtle.fd(60)
turtle.left(180)
turtle.fd(85)
turtle.left(90)
turtle.fd(80)
# 叶子2
turtle.right(90)
turtle.right(45)
turtle.fillcolor("green")
turtle.begin_fill()
turtle.circle(80, 90)
turtle.left(90)
turtle.circle(80, 90)
turtle.end_fill()
turtle.left(135)
turtle.fd(60)
turtle.left(180)
turtle.fd(60)
turtle.right(90)
turtle.circle(200, 60)
turtle.pendown()
turtle.done()
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
效果
c语言画心形
代码
#include <stdio.h>
#include <math.h>
int main()
{
//FILE *fp = fopen("graph.txt", "w+");
float x, y, f;
for(y = 1.6; y >= -1.6; y -= 0.15){
for(x = -1.1; x <= 1.1; x += 0.05){
f = x*x + pow(y - pow(x*x, 1.0/3), 2) - 1; //函数方程
//fputc(f <= 1E-5 ? '*' : ' ', fp);
putchar(f <= 1E-5 ? '*' : ' ');
}
//fputc('\n', fp);
putchar('\n');
}
for(y = 1.6; y >= -1.6; y -= 0.15){
for(x = -1.1; x <= 1.1; x += 0.05){
f = x*x + pow(y - pow(x*x, 1.0/3), 2) - 1; //函数方程
//fputc(f > 1E-5 ? '*' : ' ', fp);
putchar(f > 1E-5 ? '*' : ' ');
}
//fputc('\n', fp);
putchar('\n');
}
//fclose(fp);
return 0;
}
1234567891011121314151617181920212223242526272829
由于c没有图形界面,只有在控制台输出啦
matlab画3D玫瑰
代码
function drawrose
grid on
[x,t]=meshgrid((0:24)./24,(0:0.5:575)./575.*20.*pi+4*pi);
p=(pi/2)*exp(-t./(8*pi));
change=sin(15*t)/150;
u=1-(1-mod(3.6*t,2*pi)./pi).^4./2+change;
y=2*(x.^2-x).^2.*sin(p);
r=u.*(x.*sin(p)+y.*cos(p));
h=u.*(x.*cos(p)-y.*sin(p));
map=[1.0000 0.6471 0.8275
0.9984 0.6353 0.8130
0.9969 0.6236 0.7985
0.9953 0.6118 0.7840
0.9937 0.6000 0.7695
0.9921 0.5882 0.7550
0.9906 0.5765 0.7404
0.9890 0.5647 0.7259
0.9874 0.5529 0.7114
0.9859 0.5412 0.6969
0.9843 0.5294 0.6824
0.9757 0.5149 0.6730
0.9670 0.5004 0.6636
0.9584 0.4859 0.6541
0.9498 0.4714 0.6447
0.9411 0.4568 0.6353
0.9325 0.4423 0.6259
0.9239 0.4278 0.6165
0.9153 0.4133 0.6070
0.9066 0.3988 0.5976
0.8980 0.3843 0.5882
0.8937 0.3780 0.5756
0.8894 0.3718 0.5631
0.8851 0.3655 0.5505
0.8808 0.3592 0.5380
0.8764 0.3529 0.5254
0.8721 0.3467 0.5129
0.8678 0.3404 0.5003
0.8635 0.3341 0.4878
0.8592 0.3279 0.4752
0.8549 0.3216 0.4627
0.8561 0.3165 0.4596
0.8573 0.3114 0.4564
0.8584 0.3063 0.4533
0.8596 0.3012 0.4502
0.8608 0.2961 0.4471
0.8620 0.2910 0.4439
0.8632 0.2859 0.4408
0.8643 0.2808 0.4377
0.8655 0.2757 0.4345
0.8667 0.2706 0.4314
0.8549 0.2620 0.4165
0.8432 0.2533 0.4016
0.8314 0.2447 0.3867
0.8196 0.2361 0.3718
0.8078 0.2274 0.3569
0.7961 0.2188 0.3420
0.7843 0.2102 0.3271
0.7725 0.2016 0.3122
0.7608 0.1929 0.2973
0.7490 0.1843 0.2824
0.7553 0.1827 0.2855
0.7616 0.1812 0.2887
0.7678 0.1796 0.2918
0.7741 0.1780 0.2949
0.7804 0.1764 0.2980
0.7867 0.1749 0.3012
0.7930 0.1733 0.3043
0.7992 0.1717 0.3074
0.8055 0.1702 0.3106
0.8118 0.1686 0.3137
0.7977 0.1631 0.3023
0.7836 0.1576 0.2910
0.7694 0.1521 0.2796
0.7553 0.1466 0.2682
0.7412 0.1411 0.2569
0.7271 0.1357 0.2455
0.7130 0.1302 0.2341
0.6988 0.1247 0.2227
0.6847 0.1192 0.2114
0.6706 0.1137 0.2000
0.6686 0.1141 0.1996
0.6667 0.1145 0.1992
0.6647 0.1149 0.1988
0.6628 0.1153 0.1984
0.6608 0.1157 0.1981
0.6588 0.1160 0.1977
0.6569 0.1164 0.1973
0.6549 0.1168 0.1969
0.6530 0.1172 0.1965
0.6510 0.1176 0.1961];
set(gca,'CameraPosition',[2 2 2])
hold on
surface(r.*cos(t),r.*sin(t),h,'EdgeAlpha',0.1,...
'EdgeColor',[0 0 0],'FaceColor','interp')
colormap(map)
end
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
效果
java画玫瑰线
代码
import java.awt.Canvas;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
public class RoseJFrame extends JFrame implements ActionListener {
private RoseCanvas canvas;
public RoseJFrame() {
super("四叶玫瑰线");
Dimension dim = getToolkit().getScreenSize();
this.setBounds(dim.width/4, dim.height/4, dim.width/2, dim.height/2);
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
JPanel jpanel = new JPanel();
this.getContentPane().add(jpanel, "North");
JButton button_color = new JButton("选择颜色");
jpanel.add(button_color);
button_color.addActionListener(this);
this.canvas = new RoseCanvas(Color.red);
this.getContentPane().add(this.canvas, "Center");
this.setVisible(true);
}
@Override
public void actionPerformed(ActionEvent e) {
Color c = JColorChooser.showDialog(this, "选择颜色", Color.blue);
this.canvas.setColor(c);
this.canvas.repaint();
}
public static void main(String args[])
{
new RoseJFrame();
}
class RoseCanvas extends Canvas {
private Color color;
public RoseCanvas(Color color) {
this.setColor(color);
}
public void setColor(Color color) {
this.color = color;
}
public void paint(Graphics g) {
int x0 = this.getWidth() / 2;
int y0 = this.getHeight() / 2;
g.setColor(this.color);
g.drawLine(x0, 0, x0, y0 * 2);
g.drawLine(0, y0, x0*2, y0);
for (int j = 40; j < 100; j += 20)
for (int i = 0; i < 1024; i++) {
double angle = i*Math.PI/512;
double radius = j*Math.sin(8*angle);
int x = (int)Math.round(radius * Math.cos(angle) * 2);
int y = (int)Math.round(radius * Math.sin(angle));
g.fillOval(x0 + x, y0 + y*2, 2, 2);
}
}
}
}
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
运行效果
html动态玫瑰玫瑰
代码
<!DOCTYPE html>
<html>
<head>
<title>flower</title>
<meta charset="utf-8">
</head>
<body>
<h1 align="center">A beautiful flower for the most beautiful person under the sun</h1>
<br>
<h1 align="center">LOVE</h1>
<p style="text-align: center;">
<canvas id="c" height="500" width="500"></canvas>
<script>
var b = document.body;
var c = document.getElementsByTagName('canvas')[0];
var a = c.getContext('2d');
document.body.clientWidth;
</script>
<script>
with(m=Math)C=cos,S=sin,P=pow,R=random;c.width=c.height=f=500;h=-250;function p(a,b,c){if(c>60)return[S(a*7)*(13+5/(.2+P(b*4,4)))-S(b)*50,b*f+50,625+C(a*7)*(13+5/(.2+P(b*4,4)))+b*400,a*1-b/2,a];A=a*2-1;B=b*2-1;if(A*A+B*B<1){if(c>37){n=(j=c&1)?6:4;o=.5/(a+.01)+C(b*125)*3-a*300;w=b*h;return[o*C(n)+w*S(n)+j*610-390,o*S(n)-w*C(n)+550-j*350,1180+C(B+A)*99-j*300,.4-a*.1+P(1-B*B,-h*6)*.15-a*b*.4+C(a+b)/5+P(C((o*(a+1)+(B>0?w:-w))/25),30)*.1*(1-B*B),o/1e3+.7-o*w*3e-6]}if(c>32){c=c*1.16-.15;o=a*45-20;w=b*b*h;z=o*S(c)+w*C(c)+620;return[o*C(c)-w*S(c),28+C(B*.5)*99-b*b*b*60-z/2-h,z,(b*b*.3+P((1-(A*A)),7)*.15+.3)*b,b*.7]}o=A*(2-b)*(80-c*2);w=99-C(A)*120-C(b)*(-h-c*4.9)+C(P(1-b,7))*50+c*2;z=o*S(c)+w*C(c)+700;return[o*C(c)-w*S(c),B*99-C(P(b, 7))*50-c/3-z/1.35+450,z,(1-b/1.2)*.9+a*.1, P((1-b),20)/4+.05]}}setInterval('for(i=0;i<1e4;i++)if(s=p(R(),R(),i%46/.74)){z=s[2];x=~~(s[0]*f/z-h);y=~~(s[1]*f/z-h);if(!m[q=y*f+x]|m[q]>z)m[q]=z,a.fillStyle="rgb("+~(s[3]*h)+","+~(s[4]*h)+","+~(s[3]*s[3]*-80)+")",a.fillRect(x,y,1,1)}',0)
</script><br>
</p>
</body>
</html>
1234567891011121314151617181920212223242526
效果
#祝大家顺利脱单~
相关推荐
- C#.NET Autofac 详解(c# autoit)
-
简介Autofac是一个成熟的、功能丰富的.NET依赖注入(DI)容器。相比于内置容器,它额外提供:模块化注册、装饰器(Decorator)、拦截器(Interceptor)、强o的属性/方法注...
- webapi 全流程(webapi怎么部署)
-
C#中的WebAPIMinimalApi没有控制器,普通api有控制器,MinimalApi是直达型,精简了很多中间代码,广泛适用于微服务架构MinimalApi一切都在组控制台应用程序类【Progr...
- .NET外挂系列:3. 了解 harmony 中灵活的纯手工注入方式
-
一:背景1.讲故事上一篇我们讲到了注解特性,harmony在内部提供了20个HarmonyPatch重载方法尽可能的让大家满足业务开发,那时候我也说了,特性虽然简单粗暴,但只能解决95%...
- C# 使用SemanticKernel调用本地大模型deepseek
-
一、先使用ollama部署好deepseek大模型。具体部署请看前面的头条使用ollama进行本地化部署deepseek大模型二、创建一个空的控制台dotnetnewconsole//添加依赖...
- C#.NET 中间件详解(.net core中间件use和run)
-
简介中间件(Middleware)是ASP.NETCore的核心组件,用于处理HTTP请求和响应的管道机制。它是基于管道模型的轻量级、模块化设计,允许开发者在请求处理过程中插入自定义逻辑。...
- IoC 自动注入:让依赖注册不再重复劳动
-
在ASP.NETCore中,IoC(控制反转)功能通过依赖注入(DI)实现。ASP.NETCore有一个内置的依赖注入容器,可以自动完成依赖注入。我们可以结合反射、特性或程序集扫描来实现自动...
- C#.NET 依赖注入详解(c#依赖注入的三种方式)
-
简介在C#.NET中,依赖注入(DependencyInjection,简称DI)是一种设计模式,用于实现控制反转(InversionofControl,IoC),以降低代码耦合、提高可...
- C#从零开始实现一个特性的自动注入功能
-
在现代软件开发中,依赖注入(DependencyInjection,DI)是实现松耦合、模块化和可测试代码的一个重要实践。C#提供了优秀的DI容器,如ASP.NETCore中自带的Micr...
- C#.NET 仓储模式详解(c#仓库货物管理系统)
-
简介仓储模式(RepositoryPattern)是一种数据访问抽象模式,它在领域模型和数据访问层之间创建了一个隔离层,使得领域模型无需直接与数据访问逻辑交互。仓储模式的核心思想是将数据访问逻辑封装...
- C#.NET 泛型详解(c# 泛型 滥用)
-
简介泛型(Generics)是指在类型或方法定义时使用类型参数,以实现类型安全、可重用和高性能的数据结构与算法为什么需要泛型类型安全防止“装箱/拆箱”带来的性能损耗,并在编译时检测类型错误。可重用同一...
- 数据分析-相关性分析(相关性 分析)
-
相关性分析是一种统计方法,用于衡量两个或多个变量之间的关系强度和方向。它通过计算相关系数来量化变量间的线性关系,从而帮助理解变量之间的相互影响。相关性分析常用于数据探索和假设检验,是数据分析和统计建模...
- geom_smooth()函数-R语言ggplot2快速入门18
-
在每节,先运行以下这几行程序。library(ggplot2)library(ggpubr)library(ggtext)#用于个性化图表library(dplyr)#用于数据处理p...
- 规范申报易错要素解析(规范申报易错要素解析)
-
为什么要规范申报?规范申报是以满足海关监管、征税、统计等工作为目的,纳税义务人及其代理人依法向海关如实申报的行为,也是海关审接单环节依法监管的重要工作。企业申报的内容须符合《中华人民共和国海关进出口货...
- 「Eurora」海关编码归类 全球海关编码查询 关务服务
-
海关编码是什么? 海关编码即HS编码,为编码协调制度的简称。 其全称为《商品名称及编码协调制度的国际公约》(InternationalConventionforHarmonizedCo...
- 9月1日起,河南省税务部门对豆制品加工业试行新政7类豆制品均适用投入产出法
-
全媒体记者杨晓川报道9月2日,记者从税务部门获悉,为减轻纳税人税收负担,完善农产品增值税进项税额抵扣机制,根据相关规定,结合我省实际情况,经广泛调查研究和征求意见,从9月1日起,我省税务部门对豆制品...
- 一周热门
- 最近发表
- 标签列表
-
- mybatiscollection (79)
- mqtt服务器 (88)
- keyerror (78)
- c#map (65)
- xftp6 (83)
- bt搜索 (75)
- c#var (76)
- xcode-select (66)
- mysql授权 (74)
- 下载测试 (70)
- linuxlink (65)
- pythonwget (67)
- androidinclude (65)
- libcrypto.so (74)
- linux安装minio (74)
- ubuntuunzip (67)
- vscode使用技巧 (83)
- secure-file-priv (67)
- vue阻止冒泡 (67)
- jquery跨域 (68)
- php写入文件 (73)
- kafkatools (66)
- mysql导出数据库 (66)
- jquery鼠标移入移出 (71)
- 取小数点后两位的函数 (73)