- 浏览: 391968 次
- 性别:
- 来自: 上海
文章分类
最新评论
-
yanmie:
您的文章已被我们收录地址:http://www.airmyth ...
学习一下 Pixel Bender -
chaimzane:
我现在自己都有点看不懂了 实际上很简单, LocaleModu ...
Flex 优化技巧 -- 全局CSS样式模块实现RSLS 方式加载 -
muqingren:
以我现在对flex的了解,没看懂你说的........... ...
Flex 优化技巧 -- 全局CSS样式模块实现RSLS 方式加载 -
cony138:
卤煮碉堡了啊
A*寻路 -- 更加真实 的路径(一) -
jack_ye:
[/flash][/flash][/fl[u][u]ash][ ...
Alternativa3D 8 基础理论 / 概念
即根据3个点即width height 求 matrix 中的正反面,这个问题有两种解法,一个是观察法 还有一个是用向量的叉积来算。
/**
*点与点的关系有9种位置关系,两点相等返回0,其余的关系安 1-8,逆时针计算,比如第一象限为1
*p_target相对于p_orgin的关系
* -----------------------------------------------------------------------------
* ++ | -+ | -- | +- |(sX,sY)
* p1_0 p2_0 | p1_0 p2_0 | p1_0 p2_0 | p1_0 p2_0 |
* 1 7 | 1 3 | 1 7 | 1 3 |(pointPositionNo)
* 2 8 | 2 4 | 2 8 | 2 4 |
* 3 1 | 3 5 | 3 1 | 3 5 |
* 4 2 | 4 6 | 4 2 | 4 6 |
* 5 3 | 5 7 | 5 3 | 5 7 |
* 6 4 | 6 8 | 6 4 | 6 8 |
* 7 5 | 7 1 | 7 5 | 7 1 |
* 8 6 | 8 2 | 8 6 | 8 2 |
* | | | |
* 正 | 反 | 正 | 反 |(正反)
* | | | |
* r=q | r=PI-q | r=PI-q | r=q |p0_p1 于+X轴角度 q
* | | | |
* (1) | (2) | (3) | (4) |
* -----------------------------------------------------------------------------
*
* 相关尺寸的计算
* 运用到 DPI Matrix Point
* eg:
* 1.将物理尺寸转化为屏幕尺寸
* p0,p1,p2,p3(mmm),etc.根据 USER_SCREEN_DPI 和 MMM_PER_INCH 转化为 p0,p1,p2,p3(pix)
*
* 2.根据p0,p1,p2,p3,width(pix),height(pix)计算matrix
* a.p0 - p1 = (实际)width | p0 - p2 = (实际)height
* 计算|sX| |sY|
* b.根据p0,p1,p2,p3,countPositive2NegativeBy4Point计算图像的正反
* isPositive = countPositive2NegativeBy3Point(p0,p1,p2);
* c.p0 - p1 的角度
* radian = countRadianByP0AndP1(p0,p1);
* d.根据公式
* var a:Number = sX * Math.cos(radian);
* var b:Number = sX * Math.sin(radian);
* var c:Number = -isPositive*sY * Math.sin(radian);
* var d:Number = isPositive*sY * Math.cos(radian);
* var tx:Number = p0.x;
* var ty:Number = p0.y;
*
* 3.将屏幕尺寸转化为物理尺寸
*
*
*/
//返回p0和p1形成的角度(弧度制 -PI - PI)
public static function countRadianByP0AndP1(p0:Point,p1:Point):Number {
var dx:Number = p1.x - p0.x;
var dy:Number = p1.y - p0.y;
var radian:Number = Math.atan2(dy,dx);
return radian;
}
public static function cout3PointWHToMatrix(
p0:Point,
p1:Point,
p2:Point,
originPixWidth:Number,
originPixHeight:Number):Matrix {
var w:Number = Point.distance(p0,p1);
var h:Number = Point.distance(p0,p2);
var sX:Number = w/originPixWidth;
var sY:Number = h/originPixHeight;
var radian:Number = countRadianByP0AndP1(p0,p1);
var isPositive:int = countPositive2NegativeBy3Point(p0,p1,p2);
var a:Number = sX * Math.cos(radian);
var b:Number = sX * Math.sin(radian);
var c:Number = -isPositive*sY * Math.sin(radian);
var d:Number = isPositive*sY * Math.cos(radian);
var tx:Number = p0.x;
var ty:Number = p0.y;
return new Matrix(a,b,c,d,tx,ty);
}
//p0_p1 X p0_p3(叉积) > 0 则p1 在p0_p3向量的左侧,则图片为反的,同理 < 0, p1在 p0_p3 的右侧
//图片为正, =0 则p1在p0_p3上,图片为中间
public static function countPositive2NegativeBy3Point(p0:Point,p1:Point,p2:Point):int {
var p0_p1:Point = p1.subtract(p0);//计算向量p0_p1下同
var p0_p2:Point = p2.subtract(p0);
var p0_p3:Point = p0_p1.add(p0_p2);
var p0_p1Xp0_p3:Number = p0_p1.x*p0_p3.y - p0_p3.x*p0_p1.y;
return p0_p1Xp0_p3>0?1:(p0_p1Xp0_p3<0?-1:0);
}
发表评论
-
blog
2014-01-21 13:37 888http://www.catalinzima.com/ -
在cocos2d-x中实践数据驱动的游戏开发
2014-01-21 09:33 3348from: http://elvisco.de/2013/0 ... -
Inside the AS3 Date class: Timezones and Daylight Saving Time
2014-01-17 13:54 1230from: http://www.computus.org/ ... -
Make an AS3 Flash Component with Custom UI Controls
2013-06-28 22:24 2194from: http://studio.barliesqu ... -
234234234234
2013-06-25 21:17 0http://howtonode.org/how-to-ins ... -
AdobeMax: Deep Dive into Flash Player Rendering
2013-06-21 10:41 1550from http://www.developria.com ... -
网络游戏的对时以及同步问题
2013-05-15 16:27 1145from: http://blog.codingnow.co ... -
111
2013-04-27 22:24 0http://flashgamedojo.com -
Bitmap 海浪实现方式
2013-03-13 17:10 967Bitmap 海浪实现方式 package { ... -
Developing Flash Platform games
2012-12-25 16:37 1260转: http://www.adobe.com/inspire ... -
AS3地图拼接与战争迷雾的实现
2012-11-05 12:44 2227转:http://bbs.9ria.com/thread-1 ... -
终极优化你的游戏 —— 使用脏矩形技术
2012-10-17 10:30 1728转载: http://dev.gameres.com/arti ... -
A*寻路 -- 更加真实 的路径(一)
2012-08-11 11:58 11480转:http://bbs.9ria.com/threa ... -
仿photoshop中的取色器,制作思路
2012-07-10 16:41 2438早期在论坛的帖子,保存留念。有点感慨那时的学习尽头。 ... -
transformTool matrix
2012-07-10 15:46 1792以前在论坛发的贴,转存 原地址: http://b ... -
排序算法复习 之 AS3
2012-07-06 18:38 3999以前在论坛的贴子,保存之。 原链接: http: ... -
AS3速成-从Flash的内容中移除右键菜单
2012-07-06 14:00 2571转: http://bbs.9ria.com/thread-1 ... -
AS3 四叉树
2012-07-06 10:09 1515转载:http://developbbs.com/?p=115 ... -
深入理解Flash的沙箱 – Application Domains
2012-07-04 14:18 1232转: http://kevincao.com/2010/1 ... -
2D动画实现效率评测
2012-07-02 22:31 4325转:http://www.todoair.com/2d%E5% ...
相关推荐
项目中碰到的问题
emphasis on matrix techniques is even greater than what is found in these and perhaps the subject matter discussed here might be termed linear algebraic graph theory to highlight this aspect. After ...
A matrix is **positive definite** if all its eigenvalues are positive. This implies that: \[ a^T R a > 0 \] for any non-zero vector \( a \). **Example of Positive Definite and Singular Matrix:** ...
Here, the coefficient matrix A must be Hermitian and positive semi-definite. If the null-space of A is more than one dimensional, i.e. A*X=0 allows multiple linear independent solutions, the code ...
Though it can be applied to any matrix with non-zero elements on the diagonals, convergence is only guaranteed if the matrix is either diagonally dominant, or symmetric and positive definite....
Though it can be applied to any matrix with non-zero elements on the diagonals, convergence is only guaranteed if the matrix is either diagonally dominant, or symmetric and positive definite....
When Is a Tensor Product Zero?, 367 Coordinate Matrices and Rank, 368 Characterizing Vectors in a Tensor Product, 371 Defining Linear Transformations on a Tensor Product, 374 The Tensor Product of...
is_positive_definite = all(eigenvalue > 0 for eigenvalue in np.linalg.eigvals(matrix)) ``` **第十二章:Python求协方差矩阵** 协方差矩阵描述了随机变量之间的变化关系,可以使用`numpy.cov`: ```python ...
System.out.println("Matrix is not symmetric positive definite."); return; } // 解方程组 Matrix b = new Matrix(n, 1); // 方程组的右端项 // ... 设置b的值 ... Matrix x = cd.solve(b); // 解x // ...
1)x: your data matrix samples in rows and variables in columns. 2)LV: How many variables to use from data, if not specified all variables are used. 3)method: Optional, will be selected automatically. ...
Though it can be applied to any matrix with non-zero elements on the diagonals, convergence is only guaranteed if the matrix is either diagonally dominant, or symmetric and positive definite.
Given symmetric matrices B,D ∈ R n×n and a symmetric positive definite matrix W ∈ R n×n , maximizingthe sum of the Rayleighquotientx ? Dx andthe gener- alized Rayleigh quotient x ? Bx x ? Wx on ...
disp('x is positive'); else disp('x is non-positive'); end ``` 循环结构也是常用的一部分,包括`for`和`while`循环,用于重复执行一段代码。例如: ```matlab for i = 1:10 disp(i); end ``` 函数是MATLAB...
of the Chinese population from 2015 to 2030 is forecasted by improving the Leslie matrix population prediction algorithm, as well as the progressive deduction method and the queue element method based...
disp('x is positive'); else disp('x is non-positive'); end % 数组操作 A = zeros(3); % 创建一个3x3的全零矩阵 B = A(:,2:end); % 提取第二列到最后一列 ``` 其次,MATLAB提供了丰富的内置函数和工具箱,如...
std::cerr << "Matrix is not positive definite." ; return 1; } // 求解方程组 x = ldlt_A.solve(b); // 输出解 std::cout ; return 0; } ``` 这段代码首先定义了一个3x3的系数矩阵A和一个3维的常数...
% matrix R is assigned three values. If R(x, y) = % 0, the noise at (x, y) is pepper (black). If % R(x, y) = 1, the noise at (x, y) is salt % (white). If R(x, y) = 0.5, there is no noise % assigned to...
In the SQP loop, the approximate QP should be a convex Quadratic Programming, in which the matrix Q = ▽2f(xk) should be positive semidefinite, Q ≥ 0. Actually, the Q is the Hessian matrix of the ...