Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- Be respectful, on topic and if you see a problem, Flag it.
If you would like to contact our Community Manager personally, feel free to send a private message or an email.
"normalize" documentation
brooke_spreen
Member, Developers Posts: 115 ✭✭✭
It looks like the documentation for the function "normalize" has been updated recently. I find it rather difficult to interpret.....if I had not used it several times in the past, it would be difficult to figure out which function would give me the Direction of a vector. This could maybe use some clarification? Perhaps "returns Direction" instead of "returns Vector" in the first line of documentation?
Design Engineer | Anerdgy AG
0
Comments
-
Direction is not a type in onshape, it's just a name of a field of some data types which is supposed to contain unitless vector of length 1, mathematically it's just v0 = v/|v|. For someone would be more confusing to have directions and vectors not being the same type.
1 -
That's not entirely true. If you run `debug(context, a_dir)`, the readout recognizes that it is a direction. Regardless, I think it would be informative to mention something about "direction" in the description!
Design Engineer | Anerdgy AG0 -
Something you have to remember is that a vector with units can still be describing a direction. With units, that vector also has a magnitude. An example of this is in the StartDerivative field in the opFitSpline operation.
The normalize function does not give you the "direction" of a vector, a vector is a direction. The resulting vector is in the same direction, but the magnitude is 1 (unitless).
Normalizing is a common mathematical term, just as dot product and cross products are.
Types such as "line" specify direction to differentiate between the two vectors in the definition, one for a point and one for a direction. Both are vectors that could be normalized. Vector is the data type, direction is the purpose.
3 -
The normalize function returns the unit vector of the given vector. This is what OS seems to refer to as a "Direction". A bit of documentation from the `vector` module:
is3dDirection (value) predicate
True for a unitless 3D
Vectorthat is normalized (i.e. has length1)EXAMPLE
vector(0, 0, 1)Though perhaps to avoid confusion the terminology "unit vector" is a safer bet
Design Engineer | Anerdgy AG1 -
a unitless unit vector!brooke_spreen said:Though perhaps to avoid confusion the terminology "unit vector" is a safer bet
0 -
Hehe yes ;DDesign Engineer | Anerdgy AG0

