惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Google Online Security Blog
Google Online Security Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
C
CERT Recently Published Vulnerability Notes
C
Cybersecurity and Infrastructure Security Agency CISA
Cisco Talos Blog
Cisco Talos Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
Scott Helme
Scott Helme
Project Zero
Project Zero
E
Exploit-DB.com RSS Feed
S
Secure Thoughts
K
Kaspersky official blog
L
Lohrmann on Cybersecurity
NISL@THU
NISL@THU
WordPress大学
WordPress大学
N
News and Events Feed by Topic
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
L
LINUX DO - 热门话题
小众软件
小众软件
P
Privacy & Cybersecurity Law Blog
博客园 - 聂微东
Google DeepMind News
Google DeepMind News
H
Hackread – Cybersecurity News, Data Breaches, AI and More
A
About on SuperTechFans
Hacker News: Ask HN
Hacker News: Ask HN
AWS News Blog
AWS News Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
H
Hacker News: Front Page
F
Full Disclosure
Latest news
Latest news
Schneier on Security
Schneier on Security
The Hacker News
The Hacker News
T
Troy Hunt's Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Jina AI
Jina AI
Martin Fowler
Martin Fowler
P
Proofpoint News Feed
TaoSecurity Blog
TaoSecurity Blog
G
GRAHAM CLULEY
Forbes - Security
Forbes - Security
V
V2EX - 技术
酷 壳 – CoolShell
酷 壳 – CoolShell
V
Vulnerabilities – Threatpost
C
Cyber Attacks, Cyber Crime and Cyber Security
MongoDB | Blog
MongoDB | Blog
博客园 - 三生石上(FineUI控件)
S
SegmentFault 最新的问题
Hugging Face - Blog
Hugging Face - Blog
P
Privacy International News Feed
C
Check Point Blog
N
News and Events Feed by Topic

博客园 - davin

Beginning Asp.Net Security 读书笔记-----XSS phonegap3.0+HTMLl5 开发 ipad app 总结 移动支付-修复FireFox在android移动设备下面的Session 丢失的问题 Window.history.forward(1) 阻止页面后退详解 Pro WPF and Silverlight MVVM:第5章 Event and Command 读书笔记 Pro WPF and Silverlight MVVM 第4章ViewModel 读书笔记 Silverlight4:Devexpress Report Useful rules for compatible with FF,safari and ie8 Entity Framework 4.0 FK Properties && FK Associations Entity Framework 4.0 recipes 读书笔记2 ExecuteStoreQuery() Entity Framework 4.0 Recipes 读书笔记1 EDM中的 Complex Type sqlserver2008 + team foundation server 2008 sp1 silverlight animation 读书笔记(4)三角函数 silverlight animation 读书笔记<2>模糊, 裁剪,拖拽 foundation silverligh3 animation 读书笔记<1>transform 在silverlight中打开调用外部程序的几种方式 Entity Framework object && Json 序列化的问题 silverlight3:(ItemControl 的)UI Virtualization SharpZipLib 数据压缩
silverlight animation 读书笔记(3)坐标与向量
davin · 2010-09-01 · via 博客园 - davin

这似乎是我在不写acm程序之后,第一次这么清晰在程序语言中接触到这么纯粹的数学语言,

坐标与坐标轴 (坐标:coordinate system,坐标轴,x 轴(X axis),y轴(Y axis)):

在数学里面的坐标系统逆时针旋转分为1,2,3,4象限,但是在silverlight中Y坐标轴被翻转了,即是说对于一个Canvas对象而言,左上角顶点为(0,0),向下和向右方向分别为Y轴和X轴的正方向

矢量和速度(Vectors and velocity):数学中的矢量是具有方向性,在Silverlight中的矢量其实就是在讲速度与方向,速度:在silverlight中是用来描述一个物体在该方向单位时间移动的距离,

矢量的定义就可以描述为是在一段距离的方向与大小。在一维空间里,想想最早接触到的坐标轴(负数 0 整数这样的数轴);

无论是1维空间,还是2维空间都是这2个方法Canvas.SetLeft(),Canvas.SetTop();

来改变 对象在x,y轴方向的距离,从而形成线性轨迹:

eg:Canvas.SetLeft(this,Canvas.GetLeft(this)+10);Canvas.SetTop(this,Canvas.GetTop(this)+10);

改变矢量的方向(changing the direction of a vector):

矢量方向的典型例子就是反射,当光的反射的主要特点就是入射角=反射角,反映到向量上可能就是将速度在x或y轴上的分量进行反向及*-1;如果是在封闭区域就存在一个边界判断的问题,假设有一个矩形的封闭区域,有一个小球,从某一位置以某一矢量的速度向前运行,这里就有一个边界的问片段中的代码就是来判断越界的问题,当在物体远离left,向右移动需要将物体本身的宽度计算在内,因为每次拿到物体当前位置的是left和top。

在这个实例中(我对书中的例子做了修改),例子中的球(ball)遇到墙之后的路径就是的反射。

还是在分析下边界的判断问题:设置几个变量appHeight:球运动的区域高度;appWidth:球运动的区域宽度,ball:球,wall:可移动的墙

1.上下边界问题:上边界:CanVas.GetTop(ball)>0 即可;下边界CanVas.GetTop(ball)+ball.Height<appHeight

2.左右边界:左边界:CanVas.GetLeft(ball)>0;右边界:CanVas.GetLeft(ball)+ball.width<appWidth

 在这个里面有一个问题,现象就是:移动上面动画中的墙,会发现小球依旧会穿过墙,继续前进。思考一下就知道,产生的原因来自于拖拽,当mouse_move的时候,墙的实际位置e.GetPosition()并不是所见的位置,只有当monse_leftDown才是,这样就导致了刚才的现象。