public static Vector3[] greatArcCoordinates(pinData pin1, pinData pin2)
 {
     return(arcCoordinates(RSDESManager.earthPos, RSDESManager.EarthRadius,
                           directionFromLatLong(pin1.latLong).ScaleMultiplier(RSDESManager.EarthRadius)
                           .Translate(RSDESManager.earthPos),
                           directionFromLatLong(pin2.latLong).ScaleMultiplier(RSDESManager.EarthRadius)
                           .Translate(RSDESManager.earthPos), RSDESManager.LR_Resolution));
 }
Пример #2
0
        private void setupPin()
        {
            pinData myPinData = new pinData(this, pinTip.transform.position);

            RSDESManager.ins.PinnedPoints.Add(myPinData);                       //Might need a way to specify rather than all contact points
            if (!RSDESManager.ins.pinDB.ContainsKey(this))
            {
                RSDESManager.ins.pinDB.Add(this, myPinData);
            }
        }
Пример #3
0
        /// <summary>
        /// A function that finds the great arc angle measure between two pins.
        /// </summary>
        /// <param name="pin1"></param>
        /// <param name="pin2"></param>
        /// <returns>Angle in radians</returns>
        public static float greatArcLength(pinData pin1, pinData pin2)
        {
            Vector2 p1 = pin1.latLong;
            Vector2 p2 = pin2.latLong;

            Vector2 diff = angleDifference(p1, p2) * Mathf.Deg2Rad;

            float cosc = Mathf.Cos((90 - p1.x) * Mathf.Deg2Rad) * Mathf.Cos((90 - p2.x) * Mathf.Deg2Rad) + Mathf.Sin((90 - p1.x) * Mathf.Deg2Rad) * Mathf.Sin((90 - p2.x) * Mathf.Deg2Rad) * Mathf.Cos(diff.y);
            float rads = Mathf.Acos(cosc);

            return(rads);
        }
        public override void checkClassifier(EmbodiedClassifier classifier)
        {
            float   bestDist = tolerance;
            pinData pin      = default(pinData);

            //find closest point
            for (int i = 0; i < RSDESManager.ins.pinnedPoints.Count; i++)
            {
                if ((Operations.magnitude(classifier.origin - (float3)(RSDESManager.ins.pinnedPoints[i].contactPoint)) < bestDist) &&
                    (Operations.Angle(classifier.direction,
                                      pinDirection(RSDESManager.ins.pinnedPoints[i].pin)) < angleTolerance))
                {
                    pin      = RSDESManager.ins.pinnedPoints[i];
                    bestDist = Operations.magnitude(classifier.origin - (float3)RSDESManager.ins.pinnedPoints[i].contactPoint);
                }
            }
            if (!pin.Equals(default(pinData)))
            {
                pinFunction(pin.pin, classifier);
            }
        }
Пример #5
0
 public void instantiateGreatArc(pinData pinA, pinData pinB)
 {
     if (!greatArcsExist.Contains(pinA.pin.name + pinB.pin.name))
     {
         greatArcsExist.Add(pinA.pin.name + pinB.pin.name);
         LineRenderer newLR = RSDESGeneratedLine();
         newLR.GetComponent <RSDESLineData>().associatedPins = new List <pinData>()
         {
             pinA, pinB
         };
         newLR.GetComponent <RSDESLineData>().LineType = lineType.arc;
         greatArcsLRs.Add(new List <pinData> {
             pinA, pinB
         }, newLR);
         newLR.startWidth    = LR_width;
         newLR.endWidth      = LR_width;
         newLR.positionCount = LR_Resolution;
         newLR.SetPositions(GeoPlanetMaths.greatArcCoordinates(pinA.pin.transform.position, pinB.pin.transform.position, LR_Resolution));
         newLR.loop = false;
     }
 }
Пример #6
0
 public void instantiateGreatCircle(pinData pinA, pinData pinB)
 {
     if (!circlesExist.Contains(pinA.pin.name + pinB.pin.name))
     {
         circlesExist.Add(pinA.pin.name + pinB.pin.name);
         LineRenderer newLR = RSDESGeneratedLine();
         newLR.GetComponent <RSDESLineData>().associatedPins = new List <pinData> {
             pinA, pinB
         };
         newLR.GetComponent <RSDESLineData>().LineType = lineType.circle;
         newLR.startWidth    = LR_width;
         newLR.endWidth      = LR_width;
         newLR.positionCount = LR_Resolution;
         newLR.SetPositions(GeoPlanetMaths.greatCircleCoordinates(pinA.pin.transform.position, pinB.pin.transform.position, LR_Resolution));
         if (verboseLogging)
         {
             Debug.Log(newLR.name + " was created for the two points.");
         }
         newLR.loop = true;
     }
 }
Пример #7
0
        public static Vector3[] starRayRendererCoordiantes(pinData SUBPOINT, Vector2 CENTER)
        {
            Vector3 subpoint = directionFromLatLong(SUBPOINT.latLong).Translate(RSDESManager.earthPos);
            Vector3 center   = directionFromLatLong(CENTER).ScaleMultiplier(RSDESManager.EarthRadius).Translate(RSDESManager.earthPos);

            Vector3[] result = new Vector3[2];

            Vector3 direction = subpoint - RSDESManager.earthPos;

            //the moon is a special case where the lines are not parallel.
            if (SUBPOINT.pin.myPintype == RSDESPin.pintype.Moon)
            {
                direction = (directionFromLatLong(SUBPOINT.latLong).ScaleMultiplier(RSDESManager.SimulationScale * RSDESManager.moonDist).Translate(RSDESManager.earthPos) - center);
            }

            Vector3 earthPos = RSDESManager.earthPos;
            float   earthRad = RSDESManager.EarthRadius;

            result[0] = center + 500 * direction;
            result[1] = center - 500 * direction;
            return(result);
        }
Пример #8
0
 public static Vector3[] greatCircleCoordinates(pinData pin1, pinData pin2)
 {
     return(circleCoordinates(RSDESManager.earthPos, RSDESManager.EarthRadius, Vector3.Cross(directionFromLatLong(pin1.latLong), directionFromLatLong(pin2.latLong)), RSDESManager.LR_Resolution));
 }
Пример #9
0
 internal static Vector3[] starRayRendererCoordiantes(pinData myPinData)
 {
     return(starRayRendererCoordiantes(myPinData, myPinData));
 }
 public static Vector3[] starRayRendererCoordiantes(pinData SUBPOINT, pinData CENTER)
 {
     return(starRayRendererCoordiantes(SUBPOINT, CENTER.latLong));
 }