Edge.GetTangent problem
Kevin
✭✭
in RobotStudio
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
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
0
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:160 -
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
0
Categories
- All Categories
- 5.5K RobotStudio
- 396 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 249 ScreenMaker
- 2.7K Robot Controller
- 310 IRC5
- 59 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 786 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 5 Job listings