Vector API/es: Difference between revisions
(Created page with 'Los vectores se utilizan en todas partes en FreeCAD. Ejemplo: v=FreeCAD.Vector() v=FreeCAD.Vector(1,0,0) v=FreeCAD.Base.Vector() v2 = FreeCAD.Vector(3,2,-5) v3 = v.add(v2) …') |
(Updating to match new version of source page) |
||
Line 1: | Line 1: | ||
Vectors are used everywhere in FreeCAD. |
|||
Example: |
|||
Ejemplo: |
|||
<pre> |
|||
v=FreeCAD.Vector() |
|||
v=FreeCAD.Vector() |
|||
v=FreeCAD.Vector(1,0,0) |
|||
v=FreeCAD.Base.Vector() |
|||
v2 = FreeCAD.Vector(3,2,-5) |
|||
v3 = v.add(v2) |
|||
print v3.Length |
|||
</pre> |
|||
⚫ | |||
⚫ | |||
{{APIFunction/es|add|Vector|Añade otro vector a este|La suma de ambos vectores.}} |
|||
{{APIFunction |
{{APIFunction|add|Vector|adds another vector to this one|the sum of both vectors.}} |
||
{{APIFunction|cross|Vector| |the crossproduct between two vectors.}} |
|||
{{APIFunction/es|distanceToLine|Vector1,Vector2| |La distancia entre el vector y una línea entre el Vector1 y Vector2.}} |
|||
{{APIFunction |
{{APIFunction|distanceToLine|Vector1,Vector2| |the distance between the vector and a line between Vector1 and Vector2.}} |
||
{{APIFunction |
{{APIFunction|distanceToPlane|Vector1,Vector2| |the distance between the vector and a plane defined by a point and a normal.}} |
||
{{APIFunction |
{{APIFunction|dot|Vector| |the dot product between 2 vectors.}} |
||
{{APIFunction |
{{APIFunction|getAngle|Vector| |the angle in radians between 2 vectors.}} |
||
{{APIFunction |
{{APIFunction|multiply|Float|multiplies (scales) a vector by the given factor|nothing.}} |
||
{{APIFunction |
{{APIFunction|normalize| |normalizes a vector (sets its length to 1.0).|nothing.}} |
||
{{APIFunction |
{{APIFunction|projectToLine|Vector1,Vector2|projects the vector on a line between Vector1 and Vector2.|nothing.}} |
||
{{APIFunction|projectToPlane|Vector1,Vector2|projects the vector on a plane defined by a point and a normal.|nothing.}} |
|||
{{APIFunction/es|scale|Float,Float,Float|Lo mismo que multiplicar pero permite especificar valores diferentes para las direcciones X, Y y Z.|Nada.}} |
|||
{{APIFunction|scale|Float,Float,Float|Same as multiply but lets specify different values for x, y and z directions.|nothing.}} |
|||
⚫ | |||
⚫ | |||
⚫ | |||
{{APIProperty |
{{APIProperty|x|the x coordinate of a vector.}} |
||
{{APIProperty |
{{APIProperty|y|the y coordinate of a vector.}} |
||
⚫ | |||
{{languages/es | {{en|Vector_API}} }} |
|||
[[Category:API |
[[Category:API]] |
||
{{clear}} |
|||
<languages/> |
Revision as of 21:09, 11 November 2014
Vectors are used everywhere in FreeCAD.
Example:
v=FreeCAD.Vector() v=FreeCAD.Vector(1,0,0) v=FreeCAD.Base.Vector() v2 = FreeCAD.Vector(3,2,-5) v3 = v.add(v2) print v3.Length
Description:
Returns: the distance between the vector and a line between Vector1 and Vector2.
Description:
Returns: the distance between the vector and a plane defined by a point and a normal.
Description: projects the vector on a line between Vector1 and Vector2.
Returns: nothing.
Description: projects the vector on a plane defined by a point and a normal.
Returns: nothing.
Description: Same as multiply but lets specify different values for x, y and z directions.
Returns: nothing.
Description: subtracts another vector from the first one.
Returns: the resulting vector.