Variables
来源:互联网 发布:me452ch可以4g网络吗 编辑:程序博客网 时间:2024/05/16 12:21
Enlarge the font size of the script editor: Ctrl+Shift+> .
Variables
int $rad=2;
sphere -radius $rad;
Number types for variables: int, float, string, vector, and matrix.
1. For string, concatenate is done by "+"; the number of characters in the string is calculated from size(string).
2. Vector variables allow you to store three floating-point values. Typically, used to store positions and directions.
sphere;
vector $p=<<10.0, 5.0, 2.5>>;
move -absolute ($p.x) ($p.y) ($p.z);
3. To access the vector component they must be enclosed in parentheses.
4. You cannot directly assign a number to a vector's component. To change x component of $p,
$p=<<3.0, $p.y, $p.z>>;
print $p;
//Result: 3.0 5.0 2.5
5. Array type: the indices are base 0. The total number of elements in the array can be got from size function. Also you can add new element directly to the array, no matter exceeding the initial size. To remove the array and free the memory, use clear function. However, no direct way to remove elements one by one from a array.
6. Array is only one-dimension, cannot be two dimensions or higher.
7. Matrix is two dimension, cannot be resized after initialised. Both the two dimensions' index must be explicitly declared.
matrix $m[2][4] = << 3 , 4 , 6 , 7 " 3 , 9 , 0 , 1 >>;
p r i n t ( $m[O][O] )" / / Result. 3
p r i n t ( $m[1][3] )" / / Result. 1
8. You can access the element outside of the initial range for array, but cannot for matrix.
9. Once a variable's type is set, either explicitly or implicitly, it cannot be changed.
- Variables
- Variables
- Variables
- variables
- Variables
- python global variables,member variables,instance variables
- Using Variables
- Environment Variables
- Indicator Variables
- Swapping variables.
- JavaScript Variables
- VBScript Variables
- condition variables
- C++ Variables
- Matrix Variables
- Local Variables
- Condition Variables
- Auto Variables
- A Beautiful Song : Burning
- 为什么不能下载
- 为了酚啊
- 在Visual Studio 2005中安装Qt 4.3.2
- 初涉网络编程
- Variables
- 2008年11月18号_二_雪_我的惰性
- OGRE源码版配置
- SDK
- Session丢失原因与解决方案小结
- 终于决定开始写博客了
- 迁移到Linux平台应考虑的十个问题
- 外面没有别人,只有你自己---读《遇见未知的自己》摘录
- J2ME编程开发平台的几个重要概念说明