Difference between revisions of "Vector API/es"

From FreeCAD Documentation
Jump to navigation Jump to search
(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:
Los vectores se utilizan en todas partes en FreeCAD.
+
Vectors are used everywhere in FreeCAD.
  
Ejemplo:
+
Example:
v=FreeCAD.Vector()
+
<pre>
v=FreeCAD.Vector(1,0,0)
+
v=FreeCAD.Vector()
v=FreeCAD.Base.Vector()
+
v=FreeCAD.Vector(1,0,0)
v2 = FreeCAD.Vector(3,2,-5)
+
v=FreeCAD.Base.Vector()
v3 = v.add(v2)
+
v2 = FreeCAD.Vector(3,2,-5)
print v3.Length
+
v3 = v.add(v2)
 +
print v3.Length
 +
</pre>
  
{{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/es|cross|Vector| |El producto vectorial de dos vectores.}}
+
{{APIFunction|add|Vector|adds another vector to this one|the sum of both vectors.}}
  
{{APIFunction/es|distanceToLine|Vector1,Vector2| |La distancia entre el vector y una línea entre el Vector1 y Vector2.}}
+
{{APIFunction|cross|Vector| |the crossproduct between two vectors.}}
  
{{APIFunction/es|distanceToPlane|Vector1,Vector2| |La distancia entre el vector y un plano definido por un punto y una normal.}}
+
{{APIFunction|distanceToLine|Vector1,Vector2| |the distance between the vector and a line between Vector1 and Vector2.}}
  
{{APIFunction/es|dot|Vector| |El producto escalar de dos vectores.}}
+
{{APIFunction|distanceToPlane|Vector1,Vector2| |the distance between the vector and a plane defined by a point and a normal.}}
  
{{APIFunction/es|getAngle|Vector| |El ángulo en radianes entre dos vectores.}}
+
{{APIFunction|dot|Vector| |the dot product between 2 vectors.}}
  
{{APIFunction/es|multiply|Float|Multiplica (escala) un vector por el factor dado|Nada.}}
+
{{APIFunction|getAngle|Vector| |the angle in radians between 2 vectors.}}
  
{{APIFunction/es|normalize| |Normaliza un vector (establece su longitud a 1.0).|Nada.}}
+
{{APIFunction|multiply|Float|multiplies (scales) a vector by the given factor|nothing.}}
  
{{APIFunction/es|projectToLine|Vector1,Vector2|Proyecta el vector sobre una línea entre Vector1 y Vector2.|Nada.}}
+
{{APIFunction|normalize| |normalizes a vector (sets its length to 1.0).|nothing.}}
  
{{APIFunction/es|projectToPlane|Vector1,Vector2|Proyecta el vector sobre un plano definido por un punto y una normal.|Nada.}}
+
{{APIFunction|projectToLine|Vector1,Vector2|projects the vector on a line between Vector1 and Vector2.|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|projectToPlane|Vector1,Vector2|projects the vector on a plane defined by a point and a normal.|nothing.}}
  
{{APIFunction/es|sub|Vector|Resta otro vector del primero.|El vector resultante.}}
+
{{APIFunction|scale|Float,Float,Float|Same as multiply but lets specify different values for x, y and z directions.|nothing.}}
  
{{APIProperty/es|x|La coordenada X de un vector.}}
+
{{APIFunction|sub|Vector|subtracts another vector from the first one.|the resulting vector.}}
  
{{APIProperty/es|y|La coordenada Y de un vector.}}
+
{{APIProperty|x|the x coordinate of a vector.}}
  
{{APIProperty/es|z|La coordenada Z de un vector.}}
+
{{APIProperty|y|the y coordinate of a vector.}}
  
{{languages/es | {{en|Vector_API}} }}
+
{{APIProperty|z|the z coordinate of a vector.}}
  
[[Category:API/es]]
+
[[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


Property.png Length

Returns: returns the length of the vector.

Method.png add(Vector)

Description: adds another vector to this one

Returns: the sum of both vectors.

Method.png cross(Vector)

Description:

Returns: the crossproduct between two vectors.

Method.png distanceToLine(Vector1,Vector2)

Description:

Returns: the distance between the vector and a line between Vector1 and Vector2.

Method.png distanceToPlane(Vector1,Vector2)

Description:

Returns: the distance between the vector and a plane defined by a point and a normal.

Method.png dot(Vector)

Description:

Returns: the dot product between 2 vectors.

Method.png getAngle(Vector)

Description:

Returns: the angle in radians between 2 vectors.

Method.png multiply(Float)

Description: multiplies (scales) a vector by the given factor

Returns: nothing.

Method.png normalize( )

Description: normalizes a vector (sets its length to 1.0).

Returns: nothing.

Method.png projectToLine(Vector1,Vector2)

Description: projects the vector on a line between Vector1 and Vector2.

Returns: nothing.

Method.png projectToPlane(Vector1,Vector2)

Description: projects the vector on a plane defined by a point and a normal.

Returns: nothing.

Method.png scale(Float,Float,Float)

Description: Same as multiply but lets specify different values for x, y and z directions.

Returns: nothing.

Method.png sub(Vector)

Description: subtracts another vector from the first one.

Returns: the resulting vector.

Property.png x

Returns: the x coordinate of a vector.

Property.png y

Returns: the y coordinate of a vector.

Property.png z

Returns: the z coordinate of a vector.

Other languages:
Deutsch • ‎English • ‎español • ‎français • ‎italiano • ‎polski • ‎română