当前位置: 首页 > news >正文

我要表白网站在线制作东莞海外网络推广

我要表白网站在线制作,东莞海外网络推广,网站 数据库+1,威海网站建设创意来自于初中时做的硫酸铜爱心,硫酸铜是三斜晶型,这里为了方便绘制并没有采用同样的结构。 效果: 果然还是自然生长出的晶体更好看呜呜呜 坐标变换 想要画出水晶新要先会画晶体簇,画晶体簇要先会画一个晶体,画晶体…

创意来自于初中时做的硫酸铜爱心,硫酸铜是三斜晶型,这里为了方便绘制并没有采用同样的结构。
在这里插入图片描述
效果:
果然还是自然生长出的晶体更好看呜呜呜
在这里插入图片描述
在这里插入图片描述
坐标变换
想要画出水晶新要先会画晶体簇,画晶体簇要先会画一个晶体,画晶体我们需要这样一个结构:
在这里插入图片描述
我们首先需要一个到直线距离一定且垂线落点为cutPnt的点,这个非常好找,例如cutPnt=[x0,y0,z0];中轴线方向为V=[x1,y1,z1];到直线距离为L则如下点显然符合条件:

v2=[z1,z1,-x1-y1];
v2=v2./norm(v2).*L;
pnt=cutPnt+v2;

但是广找到一个点还不够,我们要找到四个而且每个点都是之前的点绕直线旋转pi/2得到的,这就要请出我们的点绕直线旋转变换矩阵:

在这里插入图片描述

。。。。可以说是超级复杂了:

rotateMat=[u^2+(v^2+w^2)*cos(theta)       ,  u*v*(1-cos(theta))-w*sin(theta),  u*w*(1-cos(theta))+v*sin(theta),  (a*(v^2+w^2)-u*(b*v+c*w))*(1-cos(theta))+(b*w-c*v)*sin(theta);u*v*(1-cos(theta))+w*sin(theta),  v^2+(u^2+w^2)*cos(theta)       ,  v*w*(1-cos(theta))-u*sin(theta),  (b*(u^2+w^2)-v*(a*u+c*w))*(1-cos(theta))+(c*u-a*w)*sin(theta);u*w*(1-cos(theta))-v*sin(theta),  v*w*(1-cos(theta))+u*sin(theta),  w^2+(u^2+v^2)*cos(theta)       ,  (c*(u^2+v^2)-w*(a*u+b*v))*(1-cos(theta))+(a*v-b*u)*sin(theta);0                              ,  0                              ,  0                              ,  1];

其中[u,v,w]是方向单位向量,[a,b,c]是轴初始点坐标

水晶簇绘制完整代码

function crystallhold on
for i=1:50len=rand(1)*8+5;tempV=rand(1,3)-0.5;tempV(3)=abs(tempV(3));tempV=tempV./norm(tempV).*len;tempEpnt=tempV;drawCrystal([0 0 0],tempEpnt,pi/6,0.8,0.1,rand(1).*0.2+0.2)disp(i)
end
ax=gca;
ax.XLim=[-15,15];
ax.YLim=[-15,15];
ax.ZLim=[-2,15];
grid on
ax.GridLineStyle='--';
ax.LineWidth=1.2;
ax.XColor=[1,1,1].*0.4;
ax.YColor=[1,1,1].*0.4;
ax.ZColor=[1,1,1].*0.4;
ax.DataAspectRatio=[1,1,1];
ax.DataAspectRatioMode='manual';
ax.CameraPosition=[-67.6287 -204.5276   82.7879];function drawCrystal(Spnt,Epnt,theta,cl,w,alpha)%plot3([Spnt(1),Epnt(1)],[Spnt(2),Epnt(2)],[Spnt(3),Epnt(3)])mainV=Epnt-Spnt;cutPnt=cl.*(mainV)+Spnt;cutV=[mainV(3),mainV(3),-mainV(1)-mainV(2)];cutV=cutV./norm(cutV).*w.*norm(mainV);cornerPnt=cutPnt+cutV;cornerPnt=rotateAxis(Spnt,Epnt,cornerPnt,theta);cornerPntSet(1,:)=cornerPnt';for ii=1:3cornerPnt=rotateAxis(Spnt,Epnt,cornerPnt,pi/2);cornerPntSet(ii+1,:)=cornerPnt';endfor ii=1:4jj=mod(ii,4)+1;fill33(Spnt,cornerPntSet(ii,:),cornerPntSet(jj,:),alpha)fill33(Epnt,cornerPntSet(ii,:),cornerPntSet(jj,:),alpha)endendfunction fill33(p1,p2,p3,alpha)fill3([p1(1),p2(1),p3(1)],[p1(2),p2(2),p3(2)],[p1(3),p2(3),p3(3)],...[0 71 177]./255,'FaceAlpha',alpha,'EdgeColor',[0 71 177]./255.*0.8,'EdgeAlpha',0.6,...'EdgeLighting','gouraud','SpecularStrength',0.3)endfunction newPnt=rotateAxis(Spnt,Epnt,cornerPnt,theta)V=Epnt-Spnt;V=V./norm(V);u=V(1);v=V(2);w=V(3);a=Spnt(1);b=Spnt(2);c=Spnt(3);cornerPnt=[cornerPnt(:);1];rotateMat=[u^2+(v^2+w^2)*cos(theta)       ,  u*v*(1-cos(theta))-w*sin(theta),  u*w*(1-cos(theta))+v*sin(theta),  (a*(v^2+w^2)-u*(b*v+c*w))*(1-cos(theta))+(b*w-c*v)*sin(theta);u*v*(1-cos(theta))+w*sin(theta),  v^2+(u^2+w^2)*cos(theta)       ,  v*w*(1-cos(theta))-u*sin(theta),  (b*(u^2+w^2)-v*(a*u+c*w))*(1-cos(theta))+(c*u-a*w)*sin(theta);u*w*(1-cos(theta))-v*sin(theta),  v*w*(1-cos(theta))+u*sin(theta),  w^2+(u^2+v^2)*cos(theta)       ,  (c*(u^2+v^2)-w*(a*u+b*v))*(1-cos(theta))+(a*v-b*u)*sin(theta);0                              ,  0                              ,  0                              ,  1];newPnt=rotateMat*cornerPnt;newPnt(4)=[];endend

在这里插入图片描述
水晶心绘制完整代码

function crystalHeart
clc;clear;close all
hold on
% drawCrystal([1,1,1],[3,3,3],pi/6,0.8,0.14)
sep=pi/8;
t=[0:0.2:sep,sep:0.02:pi-sep,pi-sep:0.2:pi+sep,pi+sep:0.02:2*pi-sep,2*pi-sep:0.2:2*pi];
x=16*sin(t).^3;
y=13*cos(t)-5*cos(2*t)-2*cos(3*t)-cos(4*t);
z=zeros(size(t));
plot3(x,y,z,'Color',[186,110,64]./255,'LineWidth',1)
for i=1:length(t)for j=1:6len=rand(1)*2+2;tempV=rand(1,3)-0.5;tempV=tempV./norm(tempV).*len;tempSpnt=[x(i),y(i),z(i)];tempEpnt=tempV+tempSpnt;drawCrystal(tempSpnt,tempEpnt,pi/6,0.8,0.14)disp([i,j])end
end
ax=gca;
ax.XLim=[-22,22];
ax.YLim=[-20,20];
ax.ZLim=[-10,10];
grid on
ax.GridLineStyle='--';
ax.LineWidth=1.2;
ax.XColor=[1,1,1].*0.4;
ax.YColor=[1,1,1].*0.4;
ax.ZColor=[1,1,1].*0.4;
ax.DataAspectRatio=[1,1,1];
ax.DataAspectRatioMode='manual';function drawCrystal(Spnt,Epnt,theta,cl,w)%plot3([Spnt(1),Epnt(1)],[Spnt(2),Epnt(2)],[Spnt(3),Epnt(3)])mainV=Epnt-Spnt;cutPnt=cl.*(mainV)+Spnt;cutV=[mainV(3),mainV(3),-mainV(1)-mainV(2)];cutV=cutV./norm(cutV).*w.*norm(mainV);cornerPnt=cutPnt+cutV;cornerPnt=rotateAxis(Spnt,Epnt,cornerPnt,theta);cornerPntSet(1,:)=cornerPnt';for ii=1:3cornerPnt=rotateAxis(Spnt,Epnt,cornerPnt,pi/2);cornerPntSet(ii+1,:)=cornerPnt';endfor ii=1:4jj=mod(ii,4)+1;fill33(Spnt,cornerPntSet(ii,:),cornerPntSet(jj,:))fill33(Epnt,cornerPntSet(ii,:),cornerPntSet(jj,:))endendfunction fill33(p1,p2,p3)fill3([p1(1),p2(1),p3(1)],[p1(2),p2(2),p3(2)],[p1(3),p2(3),p3(3)],[0 71 177]./255.*1.03,...'FaceAlpha',0.2,'EdgeColor',[0 71 177]./255.*0.9,'EdgeAlpha',0.25,'LineWidth',0.5,...'EdgeLighting','gouraud','SpecularStrength',0.3)endfunction newPnt=rotateAxis(Spnt,Epnt,cornerPnt,theta)V=Epnt-Spnt;V=V./norm(V);u=V(1);v=V(2);w=V(3);a=Spnt(1);b=Spnt(2);c=Spnt(3);cornerPnt=[cornerPnt(:);1];rotateMat=[u^2+(v^2+w^2)*cos(theta)       ,  u*v*(1-cos(theta))-w*sin(theta),  u*w*(1-cos(theta))+v*sin(theta),  (a*(v^2+w^2)-u*(b*v+c*w))*(1-cos(theta))+(b*w-c*v)*sin(theta);u*v*(1-cos(theta))+w*sin(theta),  v^2+(u^2+w^2)*cos(theta)       ,  v*w*(1-cos(theta))-u*sin(theta),  (b*(u^2+w^2)-v*(a*u+c*w))*(1-cos(theta))+(c*u-a*w)*sin(theta);u*w*(1-cos(theta))-v*sin(theta),  v*w*(1-cos(theta))+u*sin(theta),  w^2+(u^2+v^2)*cos(theta)       ,  (c*(u^2+v^2)-w*(a*u+b*v))*(1-cos(theta))+(a*v-b*u)*sin(theta);0                              ,  0                              ,  0                              ,  1];newPnt=rotateMat*cornerPnt;newPnt(4)=[];endend

在这里插入图片描述

http://www.lbrq.cn/news/2781595.html

相关文章:

  • 云南网站开发软件sem是什么仪器
  • 媒体网站模版关键词排名是由什么决定的
  • 微网站的定义微信crm客户管理系统
  • 模板下载后怎么使用windows优化大师是自带的吗
  • 网站建设的社会效益可行性分析黑龙江暴雪预警
  • 广胜达建设集团网站今日热搜榜排名
  • 网站建设与管理试卷答案指数基金投资指南
  • 旅游网站建设翻译百度官方网站网址是多少
  • 东营做网站优化公司厦门网站建设公司哪家好
  • ui设计到底是干嘛的网站seo外包
  • 阿里云云服务器ecs做网站访问慢深圳大鹏新区葵涌街道
  • 美工模板网站谷歌play
  • 个人服装定制网站教育培训报名
  • 南充做网站 www.xinbay.com2023年第三波疫情9月
  • 网站建设中 切片指什么营销策划书格式及范文
  • 网站要钱怎么怎么注册网站 个人
  • 做网站的系统功能需求好口碑关键词优化
  • 网站建设合同英文自动的网站设计制作
  • 91色做爰免费网站微信裂变营销软件
  • seo的基本步骤四个seo哪家强
  • 动态交互图网站免费外链发布平台
  • 泉州企业自助建站it培训四个月骗局
  • 电商网络销售好不好做seo推广公司招商
  • 网站备案域名还是空间百度seo网站优化 网络服务
  • 武汉便宜做网站公司专业网站优化
  • 常州门户网站建设软文发布推广平台
  • 在哪个网站做一件代发靠谱吗怎么做一个网站平台
  • 毕业设计资源网站陕西seo
  • 做网站多少钱西宁君博专注怎样和政府交换友链
  • 厦门知名网站建设百度快照手机版
  • Temu美国站大规模扫号封店:虚假本土店遭批量封禁,如何规避?
  • 【C++】模版(初阶)
  • STM32存储结构
  • Python量化交易:结合爬虫与TA-Lib技术指标分析
  • 大数据MapReduce架构:分布式计算的经典范式
  • 如何新建一个自己的虚拟环境