public MoveCameraToPositionAction(Camera camera, Vector3 toPosition, Vector3 toLookAt) { if (Vector3.DistanceSquared(camera.Position, toPosition) > 400) { var ag = new ArcGenerator(5); ag.CreateArc(camera.Position, toPosition, Vector3.Up, Vector3.Distance(camera.Position, toPosition)/8); _path = ag.Points; } else _path = new[] {camera.Position, toPosition}; _fromYaw = camera.Yaw; _toPosition = toPosition; _toLookAt = toLookAt; _toYaw = (float) Math.Atan2(toPosition.X - toLookAt.X, toPosition.Z - toLookAt.Z); //Debug.Print("ToPos: {0} ToLookAt: {1} ToYaw: {2}", _toPosition, _toLookAt, MathUtil.RadiansToDegrees(_toYaw)); var angle = _fromYaw - _toYaw; if (angle > MathUtil.Pi) _fromYaw -= MathUtil.TwoPi; else if (angle < -MathUtil.Pi) _fromYaw += MathUtil.TwoPi; }
private static void processOneIsland( List<ArcVertex> lines, CodeIsland island, VProgram vp, Dictionary<string, CodeIsland> modules) { if (island.VAssembly.Is3DParty) return; var arc = new ArcGenerator(4); foreach (var vclass in island.Classes.Values) { var arcStart = lines.Count; var done = new HashSet<VisionClass> {vclass}; foreach (var vmethod in vclass.VClass.VMethods) foreach (var name in vmethod.Calling) { VMethod callTo; if (!vp.VMethods.TryGetValue(name, out callTo)) continue; CodeIsland islandD; if (!modules.TryGetValue(callTo.AssemblyName, out islandD)) continue; var calledClass = islandD.Classes[callTo.VClass.FullName]; vclass.CalledClasses.Add(calledClass); if (done.Contains(calledClass)) continue; done.Add(calledClass); var v1 = island.World.TranslationVector + new Vector3(vclass.X, vclass.Height, vclass.Y); var v2 = islandD.World.TranslationVector + new Vector3(calledClass.X , calledClass.Height, calledClass.Y); var distance = Vector3.Distance(v1, v2)/8; arc.CreateArc( v1, v2, Vector3.Up, distance); var arcStart2 = lines.Count; arc.StoreVertices( lines, (p, f, idx) => { var c = 0.25f + f/2; return new ArcVertex( p, new Color(c, c, 1 - c, 1f), (idx%2) == 1 ? 0 : (MathUtil.TwoPi*(int) (distance/16 + 1))); }); //calledClass.IncomingArcs.Add(new StartAndCount { Start = arcStart2, Count = lines.Count - arcStart2 }); } vclass.OutgoingArcs = new StartAndCount {Start = arcStart, Count = lines.Count - arcStart}; } }