html--几何波浪

html

<!DOCTYPE html>
<html>
  <head>
     <meta charset="UTF-8">
     <title>������</title>
       <style>
          canvas{
                 position: absolute;
                 top: 0;
                 left: 0;
                }
       </style>
       <script src="js/prefixfree.min.js">
       </script>
  </head>
  <body>
      <canvas id=c></canvas>
      <script src="js/index.js"></script>
  </body>
</html>

css

canvas {
	position: absolute;
	top: 0;
	left: 0;
}

js

index.js

var w = c.width = window.innerWidth,
		h = c.height = window.innerHeight,
		ctx = c.getContext( '2d' ),
		
		opts = {
			dist: 15, //units
			sideLen: 25, //points
			waveIncrement: .02,
			distanceWaveFactor: 50,
			colorIncrement: 1,
			colorMultiplier: 100,
			
			baseY: 60,
			addedY: 50,
			depth: 400,
			maxDepth: 700,
			
			rotYVel: .01,
			
			focalLength: 250,
			vanishPoint: {
				x: w / 2,
				y: h / 2
			}
		},
		calc = {
			
			difX: Math.sqrt( 3 ) * opts.dist, // height of a equilateral triangle
			difZ: opts.dist * 3 / 2, // side of a triangle ( because it goes down to a vertex ) then half a side of the triangle in the hex below: s + s/2 = s*3/2
			translate: {
				x: -Math.sqrt( 3 ) * opts.dist * opts.sideLen / 2,
				z: -opts.dist * 3 / 2 * opts.sideLen / 2,
				y: opts.baseY
			},
			rotY: {}
		},
		
		rotY = 0,
		points = [],
		tick = 0,
		waveTick = 0,
		colorTick = 0;

function setup(){
	
	// put hexagon points in the array
	for( var i = 0; i < opts.sideLen; ++i ){
		var shiftZ = ( ( i + 1 ) % 2 ) / 2;
		
		for( var j = 0; j < opts.sideLen; ++j ){
			
			var shiftX = ( j % 2 ) / 2;
			points.push( new Point( 
				( j + shiftZ ) * calc.difX + calc.translate.x,
				calc.translate.y,
				( i + shiftX ) * calc.difZ + calc.translate.z ) );
			
			// connect
			if( points[ i * opts.sideLen + j - 1 ] && j > 0 )
				points[ points.length - 1 ].link( points[ i * opts.sideLen + j - 1 ] );
			
			if( points[ ( i - 1 ) * opts.sideLen + j ] )
				points[ points.length - 1 ].link( points[ ( i - 1 ) * opts.sideLen + j ] );
		}
	}
}

function Point( x, y, z ){
	
	this.x = x;
	this.y = y;
	this.z = z;
	
	this.screen = {
		x: 0,
		y: 0
	};
	
	this.distFromCenter = Math.sqrt( x*x + z*z ) / opts.distanceWaveFactor;
	
	this.links = [];
}
Point.prototype.link = function( point ){
	this.links.push( point );
}
Point.prototype.step = function(){
	
	var wave = -Math.sin( waveTick + this.distFromCenter ),
			x = this.x,
			y = this.y + opts.addedY * wave,
			z = this.z;
	
	// apply rotation around Y axis
	var x1 = x;
	x = x * calc.rotY.cos - z * calc.rotY.sin;
	z = z * calc.rotY.cos + x1 * calc.rotY.sin;
	
	// push back
	z += opts.depth;
	
	if( z < 0 ) 
		return false;
	
	// calculate screen position
	var scale = opts.focalLength / z;
	this.screen.x = opts.vanishPoint.x + scale * x;
	this.screen.y = opts.vanishPoint.y + scale * y;
	
	ctx.strokeStyle = 'hsla( hue, 80%, 50%, alp )'
		.replace( 'hue', colorTick + wave * opts.colorMultiplier )
		.replace( 'alp', 1 / this.distFromCenter );
	
	ctx.beginPath();
	for( var i = 0; i < this.links.length; ++i ){
		ctx.moveTo( this.screen.x, this.screen.y );
		ctx.lineTo( this.links[ i ].screen.x, this.links[ i ].screen.y );
	}
	ctx.stroke();
}
function anim(){
	
	window.requestAnimationFrame( anim );
	
	++tick;
	colorTick += opts.colorIncrement;
	waveTick += opts.waveIncrement;
	
	ctx.fillStyle = 'black';
	ctx.fillRect( 0, 0, w, h );
	
	rotY += opts.rotYVel;
	calc.rotY.cos = Math.cos( rotY );
	calc.rotY.sin = Math.sin( rotY );
	
	points.map( function( point ){ point.step(); } );
}
setup();
anim();

window.addEventListener( 'resize', function(){
	
	w = c.width = window.innerWidth;
	h = c.height = window.innerHeight;
	
	opts.vanishPoint.x = w / 2;
	opts.vanishPoint.y = h / 2;
})

prefixfree.min.js

/**
 * StyleFix 1.0.3 & PrefixFree 1.0.7
 * @author Lea Verou
 * MIT license
 */(function(){function t(e,t){return[].slice.call((t||document).querySelectorAll(e))}if(!window.addEventListener)return;var e=window.StyleFix={link:function(t){try{if(t.rel!=="stylesheet"||t.hasAttribute("data-noprefix"))return}catch(n){return}var r=t.href||t.getAttribute("data-href"),i=r.replace(/[^\/]+$/,""),s=t.parentNode,o=new XMLHttpRequest,u;o.onreadystatechange=function(){o.readyState===4&&u()};u=function(){var n=o.responseText;if(n&&t.parentNode&&(!o.status||o.status<400||o.status>600)){n=e.fix(n,!0,t);if(i){n=n.replace(/url\(\s*?((?:"|')?)(.+?)\1\s*?\)/gi,function(e,t,n){return/^([a-z]{3,10}:|\/|#)/i.test(n)?e:'url("'+i+n+'")'});var r=i.replace(/([\\\^\$*+[\]?{}.=!:(|)])/g,"\\$1");n=n.replace(RegExp("\\b(behavior:\\s*?url\\('?\"?)"+r,"gi"),"$1")}var u=document.createElement("style");u.textContent=n;u.media=t.media;u.disabled=t.disabled;u.setAttribute("data-href",t.getAttribute("href"));s.insertBefore(u,t);s.removeChild(t);u.media=t.media}};try{o.open("GET",r);o.send(null)}catch(n){if(typeof XDomainRequest!="undefined"){o=new XDomainRequest;o.onerror=o.onprogress=function(){};o.onload=u;o.open("GET",r);o.send(null)}}t.setAttribute("data-inprogress","")},styleElement:function(t){if(t.hasAttribute("data-noprefix"))return;var n=t.disabled;t.textContent=e.fix(t.textContent,!0,t);t.disabled=n},styleAttribute:function(t){var n=t.getAttribute("style");n=e.fix(n,!1,t);t.setAttribute("style",n)},process:function(){t('link[rel="stylesheet"]:not([data-inprogress])').forEach(StyleFix.link);t("style").forEach(StyleFix.styleElement);t("[style]").forEach(StyleFix.styleAttribute)},register:function(t,n){(e.fixers=e.fixers||[]).splice(n===undefined?e.fixers.length:n,0,t)},fix:function(t,n,r){for(var i=0;i<e.fixers.length;i++)t=e.fixers[i](t,n,r)||t;return t},camelCase:function(e){return e.replace(/-([a-z])/g,function(e,t){return t.toUpperCase()}).replace("-","")},deCamelCase:function(e){return e.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})}};(function(){setTimeout(function(){t('link[rel="stylesheet"]').forEach(StyleFix.link)},10);document.addEventListener("DOMContentLoaded",StyleFix.process,!1)})()})();(function(e){function t(e,t,r,i,s){e=n[e];if(e.length){var o=RegExp(t+"("+e.join("|")+")"+r,"gi");s=s.replace(o,i)}return s}if(!window.StyleFix||!window.getComputedStyle)return;var n=window.PrefixFree={prefixCSS:function(e,r,i){var s=n.prefix;n.functions.indexOf("linear-gradient")>-1&&(e=e.replace(/(\s|:|,)(repeating-)?linear-gradient\(\s*(-?\d*\.?\d*)deg/ig,function(e,t,n,r){return t+(n||"")+"linear-gradient("+(90-r)+"deg"}));e=t("functions","(\\s|:|,)","\\s*\\(","$1"+s+"$2(",e);e=t("keywords","(\\s|:)","(\\s|;|\\}|$)","$1"+s+"$2$3",e);e=t("properties","(^|\\{|\\s|;)","\\s*:","$1"+s+"$2:",e);if(n.properties.length){var o=RegExp("\\b("+n.properties.join("|")+")(?!:)","gi");e=t("valueProperties","\\b",":(.+?);",function(e){return e.replace(o,s+"$1")},e)}if(r){e=t("selectors","","\\b",n.prefixSelector,e);e=t("atrules","@","\\b","@"+s+"$1",e)}e=e.replace(RegExp("-"+s,"g"),"-");e=e.replace(/-\*-(?=[a-z]+)/gi,n.prefix);return e},property:function(e){return(n.properties.indexOf(e)?n.prefix:"")+e},value:function(e,r){e=t("functions","(^|\\s|,)","\\s*\\(","$1"+n.prefix+"$2(",e);e=t("keywords","(^|\\s)","(\\s|$)","$1"+n.prefix+"$2$3",e);return e},prefixSelector:function(e){return e.replace(/^:{1,2}/,function(e){return e+n.prefix})},prefixProperty:function(e,t){var r=n.prefix+e;return t?StyleFix.camelCase(r):r}};(function(){var e={},t=[],r={},i=getComputedStyle(document.documentElement,null),s=document.createElement("div").style,o=function(n){if(n.charAt(0)==="-"){t.push(n);var r=n.split("-"),i=r[1];e[i]=++e[i]||1;while(r.length>3){r.pop();var s=r.join("-");u(s)&&t.indexOf(s)===-1&&t.push(s)}}},u=function(e){return StyleFix.camelCase(e)in s};if(i.length>0)for(var a=0;a<i.length;a++)o(i[a]);else for(var f in i)o(StyleFix.deCamelCase(f));var l={uses:0};for(var c in e){var h=e[c];l.uses<h&&(l={prefix:c,uses:h})}n.prefix="-"+l.prefix+"-";n.Prefix=StyleFix.camelCase(n.prefix);n.properties=[];for(var a=0;a<t.length;a++){var f=t[a];if(f.indexOf(n.prefix)===0){var p=f.slice(n.prefix.length);u(p)||n.properties.push(p)}}n.Prefix=="Ms"&&!("transform"in s)&&!("MsTransform"in s)&&"msTransform"in s&&n.properties.push("transform","transform-origin");n.properties.sort()})();(function(){function i(e,t){r[t]="";r[t]=e;return!!r[t]}var e={"linear-gradient":{property:"backgroundImage",params:"red, teal"},calc:{property:"width",params:"1px + 5%"},element:{property:"backgroundImage",params:"#foo"},"cross-fade":{property:"backgroundImage",params:"url(a.png), url(b.png), 50%"}};e["repeating-linear-gradient"]=e["repeating-radial-gradient"]=e["radial-gradient"]=e["linear-gradient"];var t={initial:"color","zoom-in":"cursor","zoom-out":"cursor",box:"display",flexbox:"display","inline-flexbox":"display",flex:"display","inline-flex":"display"};n.functions=[];n.keywords=[];var r=document.createElement("div").style;for(var s in e){var o=e[s],u=o.property,a=s+"("+o.params+")";!i(a,u)&&i(n.prefix+a,u)&&n.functions.push(s)}for(var f in t){var u=t[f];!i(f,u)&&i(n.prefix+f,u)&&n.keywords.push(f)}})();(function(){function s(e){i.textContent=e+"{}";return!!i.sheet.cssRules.length}var t={":read-only":null,":read-write":null,":any-link":null,"::selection":null},r={keyframes:"name",viewport:null,document:'regexp(".")'};n.selectors=[];n.atrules=[];var i=e.appendChild(document.createElement("style"));for(var o in t){var u=o+(t[o]?"("+t[o]+")":"");!s(u)&&s(n.prefixSelector(u))&&n.selectors.push(o)}for(var a in r){var u=a+" "+(r[a]||"");!s("@"+u)&&s("@"+n.prefix+u)&&n.atrules.push(a)}e.removeChild(i)})();n.valueProperties=["transition","transition-property"];e.className+=" "+n.prefix;StyleFix.register(n.prefixCSS)})(document.documentElement);

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

下载

https://download.csdn.net/download/stqer/89240138

  • 10
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
以下是基于MATLAB的R-D方程几何纠正代码: ```matlab % 读取SAR图像 img = imread('sar_image.tif'); % 定义SAR参数 fc = 5.3e9; % 雷达频率 lambda = 3e8/fc; % 波长 R0 = 3000; % 雷达距离 PRF = 5000; % 脉冲重复频率 V = 700; % 雷达平台速度 h = 1000; % 雷达平台高度 theta_s = 20; % 俯仰角 theta_i = 30; % 方位角 % 定义地球参数 Re = 6371000; % 地球平均半径 ecc = 0.08181919; % 地球椭球体偏心率 Rp = Re*(1-ecc^2); % 地球极半径 % 计算SAR图像像素坐标系 [N, M] = size(img); x = linspace(-M/2, M/2, M); y = linspace(-N/2, N/2, N); [X, Y] = meshgrid(x, y); % 计算地球坐标系 theta = atan2(Y, R0+X); R = sqrt((R0+X).^2 + Y.^2); phi = asin(cos(theta_s)*sin(theta_i) + sin(theta_s)*cos(theta_i).*cos(theta)); lambda_s = atan2(sin(theta_i).*sin(theta), cos(theta_i).*cos(theta_s)-sin(theta_i).*sin(theta_s).*cos(theta)); phi_s = asin(sin(theta_s).*sin(theta_i) - cos(theta_s).*cos(theta_i).*cos(theta)); R_s = h./cos(phi_s); % 计算R-D方程参数 a = V^2/(2*fc*Rp*cos(phi_s)); b = V^2/(2*fc*Rp*cos(phi)); c = V^2/(2*fc*Rp); % 计算几何校正后的R-D图像 Rc = sqrt(R.^2 + (a-b)^2 - 2*R.*(a-b).*cos(phi)); D = sqrt((R_s-Rc).^2 + c^2 - 2*(R_s-Rc).*c.*cos(phi_s-phi)); img_corr = img.*(R./Rc).^2.*cos(phi)./D; % 显示几何校正后的R-D图像 figure; imshow(abs(img_corr), []); ``` 需要注意的是,这个代码只是一个简单的示例,实际应用中需要根据具体的SAR参数和地球参数进行调整。此外,由于R-D方程几何校正需要用到DEM数据,因此在实际应用中还需要考虑如何获取和处理DEM数据。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

fo安方

觉得俺的文章还行,感谢打赏,爱

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值