Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Input: 
v1start : ARRAY [0..2] OF LREAL;
v1end : ARRAY [0..2] OF LREAL;

Output:

dot_funcmyHelperForLinear : LREAL;
Info

Type: Function

Responsible: Magnus


Simple helper function for 24_7 Forward Kinematics. Concept taken from wikipedia. Simply multiplies x1 * x2 + y1 * y2 + z1 * z2 = dot product.Simply calculates the Euclidean Distance again. Another helper function used in a slightly different way.


Code Block
languageactionscript3
titleCode Overview
linenumberstrue
FUNCTION dot_funcmyHelperForLinear : LREAL
VAR_INPUT
	v1start : ARRAY [0..2] OF LREAL;
	v2end : ARRAY [0..2] OF LREAL;
END_VAR
VAR
	result : LREAL := 0;
	i : INT;
END_VAR

FORmyHelperForLinear i:= SQRT((start[0 TO 2 DO
	result := result + v1[i] * v2[i];
END_FOR
dot_func := result]-end[0])*(start[0]-end[0]) + (start[1]-end[1])*(start[1]-end[1]) + (start[2]-end[2])*(start[2]-end[2]));