RobotStudio event

Edge.GetTangent problem

RS V 5.13.01.

The returned tangent vector does not change when the wire is rotated.

Example:

I create a line from (0,0,20) to (100,0,20).

Then [CODE]edge.GetTangent(edge.EndVertex.Position)[/CODE] returns'Tangent vector = [1 0 0]' as expected.

If I then rotate the line (Body or Part) 45 degrees about the Z axis, the returned tangent vector remains '[1 0 0]'. Surely this is wrong ... or am I misunderstanding something?

Thanks,

Kevin


Comments

  • Hi,
    the tangent is local to the wire, so you have to transform it to global coordindinates before you see a difference after rotating the wire.
     

    Example:

    [CODE]

    Body line = Body.CreateLine(new Vector3(0, 0, 0.2), new Vector3(1, 0, 0.20));
    Station s = Project.ActiveProject as Station;
    Part p = new Part();
    p.Bodies.Add(line);
    s.GraphicComponents.Add(p);

    Edge e = line.Shells[0].Wires[0].Coedges[0].Edge;
    Vector3 tangent1 = e.GetTangent(e.EndVertex.Position);
    Matrix4 toGlobal = line.Transform.GlobalMatrix;
    Vector3 global = toGlobal.MultiplyVector(tangent1);
    Logger.AddMessage(new LogMessage(global.ToString()));
    p.Transform.RY = Globals.DegToRad(45);
    Vector3 tangent2 = e.GetTangent(e.EndVertex.Position);
    toGlobal = line.Transform.GlobalMatrix;
    global = toGlobal.MultiplyVector(tangent2);
    Logger.AddMessage(new LogMessage(global.ToString()));

    [/CODE]
    Niklas Skoglund2010-07-16 15:59:16

    Best Regards, Niklas Skoglund
    ABB Robotics

    Developer Center
    RobotStudio Blog
  • Kevin
    Kevin ✭✭
    Thanks Niklas,

    I thought that a tangent, like a normal, was a direction relative to the global origin, and that it would already be transformed to the global coordinate system.

    It would be good if the API help could be enhanced to state for each method, which parameters are relative to the global and which to the local coordinate system.

    Regards,

    Kevin