Normalize 和 normalized

首先说明下,normalized的是vector的属性,而Normalize 是vector的方法
normalized和Normalize 都是可读的,读到的值是单位向量的值,只是nomalized不会更改当前vector本身的值,只是返回计算后单位向量的值,而Normalize 更改了当前vector自身的值为单位向量的值。
先看看官方文档的描述:
normalized
在这里插入图片描述
Normalize ()
在这里插入图片描述
normalized数学计算本质:
就是求出当前vector的模,然后返回 模分之一*vector
Vector3 Normalized(Vector3 pos)
{
var m = Mathf.Sqrt(Mathf.Pow(pos.x, 2) + Mathf.Pow(pos.y, 2) + Mathf.Pow(pos.z, 2));
return new Vector3(pos.x / m, pos.y / m, pos.z / m);
}

### Normalize in Programming and Data Processing Normalization refers to a range of techniques used to adjust values measured on different scales to a common scale, often between 0 and 1 or -1 and 1. This process ensures that no single feature dominates due to its original measurement unit or magnitude[^4]. In machine learning and data analysis, normalization can improve model performance by ensuring features contribute equally. In programming contexts, especially within algorithms like those involving Perlin Noise generation, normalization might refer to scaling output values so they fit into an expected range. For instance, when generating noise patterns, outputs may be normalized to ensure consistent behavior across varying input parameters[^3]. For handling distances or matrices as mentioned earlier, normalization could involve converting raw distance measurements into relative terms—such as averaging them—to facilitate comparison or further computation[^1]. #### Code Example for Normalization Here's how one might implement simple min-max normalization in Python: ```python def normalize(data): """Normalize list of numbers to [0, 1]""" minimum = min(data) maximum = max(data) return [(i - minimum) / (maximum - minimum) for i in data] data_points = [1, 2, 3, 4, 5] normalized_data = normalize(data_points) print(normalized_data) ``` This function takes a set of numerical inputs and rescales all elements proportionally based on the smallest and largest value found among the dataset provided.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值