flymis/WebRoot/dojojs/src/math/curves.js
(开头部分) 7KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
/*
Copyright (c) 2004-2006, The Dojo Foundation
All Rights Reserved.
Licensed under the Academic Free License version 2.1 or above OR the
modified BSD license. For more information on Dojo licensing, see:
http://dojotoolkit.org/community/licensing.shtml
*/
dojo.provide("dojo.math.curves");
dojo.require("dojo.math");
/* Curves from Dan's 13th lib stuff.
* See: http://pupius.co.uk/js/Toolkit.Drawing.js
* http://pupius.co.uk/dump/dojo/Dojo.Math.js
*/
dojo.math.curves = {
Line: function(/* array */start, /* array */end) {
// summary
// Creates a straight line object
this.start = start;
this.end = end;
this.dimensions = start.length;
for(var i = 0; i < start.length; i++) {
start[i] = Number(start[i]);
}
for(var i = 0; i < end.length; i++) {
end[i] = Number(end[i]);
}
//simple function to find point on an n-dimensional, straight line
this.getValue = function(/* float */n){
// summary
// Returns the point at point N (in terms of percentage) on this line.
var retVal = new Array(this.dimensions);
for(var i=0;i<this.dimensions;i++)
retVal[i] = ((this.end[i] - this.start[i]) * n) + this.start[i];
return retVal; // array
}
return this; // dojo.math.curves.Line
},
Bezier: function(/* array */pnts) {
// summary
// Creates a bezier curve
// Takes an array of points, the first is the start point, the last is end point and the ones in
// between are the Bezier control points.
this.getValue = function(/* float */step) {
// summary
// Returns the point at point N (in terms of percentage) on this curve.
if(step >= 1) return this.p[this.p.length-1]; // if step>=1 we must be at the end of the curve
if(step <= 0) return this.p[0]; // if step<=0 we must be at the start of the curve
var retVal = new Array(this.p[0].length);
for(var k=0;j<this.p[0].length;k++) { retVal[k]=0; }
for(var j=0;j<this.p[0].length;j++) {
var C=0; var D=0;
后面还有 182 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。