Vector API/es: Difference between revisions

From FreeCAD Documentation
(Updating to match new version of source page)
(Updating to match new version of source page)
 
(12 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<languages/>

<div class="mw-translate-fuzzy">
Los vectores se utilizan en todas partes en FreeCAD.
</div>

Vectors are used everywhere in FreeCAD.
Vectors are used everywhere in FreeCAD.


Ejemplo:
Example:
{{Code|code=
<pre>
v=FreeCAD.Vector()
v=FreeCAD.Vector()
v=FreeCAD.Vector(1,0,0)
v=FreeCAD.Vector(1,0,0)
Line 9: Line 15:
v3 = v.add(v2)
v3 = v.add(v2)
print v3.Length
print v3.Length
}}
</pre>


<div class="mw-translate-fuzzy">
{{APIProperty/es|Length|Devuelve la longitud del vector.}}


{{APIFunction/es|add|Vector|Añade otro vector a este|La suma de ambos vectores.}}
{{APIProperty|Length|returns the length of the vector.}}
{{APIFunction|add|Vector|adds another vector to this one|the sum of both vectors.}}
{{APIFunction|cross|Vector| |the crossproduct between two vectors.}}
{{APIFunction|distanceToLine|Vector1,Vector2| |the distance between the vector and a line between Vector1 and Vector2.}}
{{APIFunction|distanceToPlane|Vector1,Vector2| |the distance between the vector and a plane defined by a point and a normal.}}
{{APIFunction|dot|Vector| |the dot product between 2 vectors.}}
{{APIFunction|getAngle|Vector| |the angle in radians between 2 vectors.}}
{{APIFunction|multiply|Float|multiplies (scales) a vector by the given factor|nothing.}}
{{APIFunction|normalize| |normalizes a vector (sets its length to 1.0).|nothing.}}
{{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|scale|Float,Float,Float|Same as multiply but lets specify different values for x, y and z directions.|nothing.}}
{{APIFunction|sub|Vector|subtracts another vector from the first one.|the resulting vector.}}
{{APIProperty|x|the x coordinate of a vector.}}
{{APIProperty|y|the y coordinate of a vector.}}
{{APIProperty|z|the z coordinate of a vector.}}


{{APIFunction/es|cross|Vector| |El producto vectorial de dos vectores.}}
[[Category:API]]


{{APIFunction/es|distanceToLine|Vector1,Vector2| |La distancia entre el vector y una línea entre el Vector1 y Vector2.}}

{{APIFunction/es|distanceToPlane|Vector1,Vector2| |La distancia entre el vector y un plano definido por un punto y una normal.}}

{{APIFunction/es|dot|Vector| |El producto escalar de dos vectores.}}

{{APIFunction/es|getAngle|Vector| |El ángulo en radianes entre dos vectores.}}

{{APIFunction/es|multiply|Float|Multiplica (escala) un vector por el factor dado|Nada.}}

{{APIFunction/es|normalize| |Normaliza un vector (establece su longitud a 1.0).|Nada.}}

{{APIFunction/es|projectToLine|Vector1,Vector2|Proyecta el vector sobre una línea entre Vector1 y Vector2.|Nada.}}

{{APIFunction/es|projectToPlane|Vector1,Vector2|Proyecta el vector sobre un plano definido por un punto y una normal.|Nada.}}

{{APIFunction/es|scale|Float,Float,Float|Lo mismo que multiplicar pero permite especificar valores diferentes para las direcciones X, Y y Z.|Nada.}}

{{APIFunction/es|sub|Vector|Resta otro vector del primero.|El vector resultante.}}

{{APIProperty/es|x|La coordenada X de un vector.}}

{{APIProperty/es|y|La coordenada Y de un vector.}}

{{APIProperty/es|z|La coordenada Z de un vector.}}
</div>

{{Userdocnavi{{#translation:}}}}
[[Category:API{{#translation:}}]]
[[Category:Poweruser Documentation{{#translation:}}]]
{{clear}}
{{clear}}
<languages/>

Latest revision as of 14:32, 18 November 2023

Other languages:

Los vectores se utilizan en todas partes en FreeCAD.

Vectors are used everywhere in 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)
print v3.Length
Length

Devuelve: Devuelve la longitud del vector.



add ( Vector )

Descripción: Añade otro vector a este

Devuelve: La suma de ambos vectores.



cross ( Vector )

Descripción:

Devuelve: El producto vectorial de dos vectores.



distanceToLine ( Vector1,Vector2 )

Descripción:

Devuelve: La distancia entre el vector y una línea entre el Vector1 y Vector2.



distanceToPlane ( Vector1,Vector2 )

Descripción:

Devuelve: La distancia entre el vector y un plano definido por un punto y una normal.



dot ( Vector )

Descripción:

Devuelve: El producto escalar de dos vectores.



getAngle ( Vector )

Descripción:

Devuelve: El ángulo en radianes entre dos vectores.



multiply ( Float )

Descripción: Multiplica (escala) un vector por el factor dado

Devuelve: Nada.



normalize ( )

Descripción: Normaliza un vector (establece su longitud a 1.0).

Devuelve: Nada.



projectToLine ( Vector1,Vector2 )

Descripción: Proyecta el vector sobre una línea entre Vector1 y Vector2.

Devuelve: Nada.



projectToPlane ( Vector1,Vector2 )

Descripción: Proyecta el vector sobre un plano definido por un punto y una normal.

Devuelve: Nada.



scale ( Float,Float,Float )

Descripción: Lo mismo que multiplicar pero permite especificar valores diferentes para las direcciones X, Y y Z.

Devuelve: Nada.



sub ( Vector )

Descripción: Resta otro vector del primero.

Devuelve: El vector resultante.



x

Devuelve: La coordenada X de un vector.



y

Devuelve: La coordenada Y de un vector.



z

Devuelve: La coordenada Z de un vector.