How to use the tar.o.orbitPatches function in tar

To help you get started, we’ve selected a few tar examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tcannonfodder / houston / public / assets / js / position_data_formatter.js View on Github external
formatTargetOrbitPatches: function(positionData, formattedData){
    if(!positionData['tar.type']){ return }
    if(positionData["tar.o.orbitPatches"].length > 0){
      formattedData.orbitPatches = formattedData.orbitPatches.concat(this.formatOrbitPatches(
        formattedData, positionData, positionData["tar.o.orbitPatches"], {
          type: "orbitPatch",
          parentType: "targetVessel",
          parentName: positionData["tar.name"]
        },{ linkedPatchType: "orbitPatch" }
      ))
    }
  },
github tcannonfodder / houston / static / js / ground_track_position_data_formatter.js View on Github external
formatTargetOrbitalPaths: function(positionData, formattedData){
    if(positionData["tar.type"] != "Vessel"){ return }
    var parentType = "targetVessel"
    var orbitPatches = positionData["tar.o.orbitPatches"]

    var pathSet = this.formatPathSet(positionData, orbitPatches, parentType, "orbitPath")

    formattedData.targetOrbitalPaths = pathSet.filter(function(x){ return x.type == "orbital" })
    formattedData.targetSuborbitalPaths = pathSet.filter(function(x){ return x.type == "suborbital" })
  },
github tcannonfodder / houston / static / js / orbital_map.js View on Github external
this.targetVesselSVG = this.targetVesselSVG || this.snapSVG.circle(targetVesselPosition[0],
      targetVesselPosition[1],
      5
    );

    this.targetVesselSVG.attr({
        cx: targetVesselPosition[0],
        cy: targetVesselPosition[1],
        fill: "purple",
        stroke: "#000",
        strokeWidth: 5
    });

    if(positionData['tar.o.orbitPatches']){
      for (var i = 0; i < positionData["tar.o.orbitPatches"].length; i++) {
        var orbitPatch = positionData["tar.o.orbitPatches"][i]
        var orbitPatchPoints = []
        var orbitPatchPositionData = orbitPatch["positionData"]
        var referenceBody = orbitPatch["referenceBody"]
        var universalTimes = Object.keys(orbitPatchPositionData)

        for (var i = 0; i < universalTimes.length; i++) {
          var universalTime = universalTimes[i]
          var relativePosition = orbitPatchPositionData[universalTime]["relativePosition"]
          var truePositionOfReferenceBody = positionData["referenceBodies"][referenceBody]["currentTruePosition"]

          var point = this.positionOnCanvasForRelativePosition(
            relativePosition,
            truePositionOfReferenceBody
          )

          orbitPatchPoints.push(point)
github tcannonfodder / houston / static / js / orbital_map.js View on Github external
)

    this.targetVesselSVG = this.targetVesselSVG || this.snapSVG.circle(targetVesselPosition[0],
      targetVesselPosition[1],
      5
    );

    this.targetVesselSVG.attr({
        cx: targetVesselPosition[0],
        cy: targetVesselPosition[1],
        fill: "purple",
        stroke: "#000",
        strokeWidth: 5
    });

    if(positionData['tar.o.orbitPatches']){
      for (var i = 0; i < positionData["tar.o.orbitPatches"].length; i++) {
        var orbitPatch = positionData["tar.o.orbitPatches"][i]
        var orbitPatchPoints = []
        var orbitPatchPositionData = orbitPatch["positionData"]
        var referenceBody = orbitPatch["referenceBody"]
        var universalTimes = Object.keys(orbitPatchPositionData)

        for (var i = 0; i < universalTimes.length; i++) {
          var universalTime = universalTimes[i]
          var relativePosition = orbitPatchPositionData[universalTime]["relativePosition"]
          var truePositionOfReferenceBody = positionData["referenceBodies"][referenceBody]["currentTruePosition"]

          var point = this.positionOnCanvasForRelativePosition(
            relativePosition,
            truePositionOfReferenceBody
          )
github tcannonfodder / houston / static / js / orbital_position_data.js View on Github external
getPositionsAndRecalculate: function(positionData){
    var requestParams = {};
    //ask for the true position for the current body right now and the radius
    var referenceBody = this.datalink.getOrbitalBodyInfo(positionData["vesselBody"])
    this.rootReferenceBody = referenceBody
    requestParams["currentReferenceBodyRadius"] = 'b.radius[' + referenceBody.id + ']'
    requestParams["currentReferenceBodyTruePosition"] = 'b.o.truePositionAtUT[' + referenceBody.id + ',' + positionData["currentUniversalTime"] + ']'
    //ask for the relative position of the vessel in the current orbit patch at the current time
    requestParams["vesselCurrentPositionRelativePosition"] = "o.relativePositionAtUTForOrbitPatch[" + 0 +","+ positionData["currentUniversalTime"] + "]"

    this.buildRelativePositionRequestsForOrbitPatches(requestParams, "vesselCurrentOrbit", positionData['o.orbitPatches'], positionData["currentUniversalTime"])
    this.buildRelativePositionRequestsForManeuverNodeOrbitPatches(requestParams, "vesselManeuverNodes", positionData['o.maneuverNodes'], positionData["currentUniversalTime"])

    if(positionData['tar.type']){
      if(positionData['tar.o.orbitPatches'] && positionData['tar.o.orbitPatches'].length > 0){
        this.buildRelativePositionRequestsForOrbitPatches(requestParams, "targetCurrentOrbit", positionData['tar.o.orbitPatches'], positionData["currentUniversalTime"], 'tar.o')
        requestParams["targetCurrentPositionRelativePosition"] = "tar.o.relativePositionAtUTForOrbitPatch[" + 0 +","+ positionData["currentUniversalTime"] + "]"
      } else{
        var body = this.datalink.getOrbitalBodyInfo(positionData['tar.name'])
        requestParams[body.name + "[metadata]radius"] = 'b.radius[' + body.id + ']'
        requestParams[body.name + "["+ positionData["currentUniversalTime"] +"]TruePosition"] = 'b.o.truePositionAtUT[' + body.id + ',' + positionData["currentUniversalTime"] + ']'
        requestParams[body.name + "[metadata]currentTruePosition"] = 'b.o.truePositionAtUT[' + body.id + ',' + positionData["currentUniversalTime"] + ']'
      }
    }

    this.datalink.sendMessage(requestParams, function(data){
      positionData["currentReferenceBodyRadius"] = data["currentReferenceBodyRadius"]
      positionData["currentReferenceBodyTruePosition"] = data["currentReferenceBodyTruePosition"]

      this.buildReferenceBodyPositionData(data, positionData)
      this.buildReferenceBodyMetadata(data, positionData)
github tcannonfodder / houston / static / js / position_data_formatter.js View on Github external
formatTargetOrbitPatches: function(positionData, formattedData){
    if(!positionData['tar.type']){ return }
    if(positionData["tar.o.orbitPatches"].length > 0){
      formattedData.orbitPatches = formattedData.orbitPatches.concat(this.formatOrbitPatches(
        formattedData, positionData, positionData["tar.o.orbitPatches"], {
          type: "orbitPatch",
          parentType: "targetVessel",
          parentName: positionData["tar.name"]
        },{ linkedPatchType: "orbitPatch" }
      ))
    }
  },
github tcannonfodder / houston / static / js / docking_position_data.js View on Github external
getPositionsAndRecalculate: function(positionData){
    var requestParams = {};

    var vesselBody = this.datalink.getOrbitalBodyInfo(positionData["vesselBody"])
    requestParams["vesselBodyTruePosition"] = 'b.o.truePositionAtUT[' + vesselBody.id + ',' + positionData["currentUniversalTime"] + ']'

    requestParams["vesselRelativePosition"] = "o.relativePositionAtUTForOrbitPatch[" + 0 +","+ positionData["currentUniversalTime"] + "]"


    if(positionData['tar.type']){
      if(positionData['tar.o.orbitPatches'] && positionData['tar.o.orbitPatches'].length > 0){
        var targetBody = this.datalink.getOrbitalBodyInfo(positionData["targetBody"])
        requestParams["targetBodyTruePosition"] = 'b.o.truePositionAtUT[' + targetBody.id + ',' + positionData["currentUniversalTime"] + ']'

        requestParams["targetRelativePosition"] = "tar.o.relativePositionAtUTForOrbitPatch[" + 0 +","+ positionData["currentUniversalTime"] + "]"
      } else{
        var body = this.datalink.getOrbitalBodyInfo(positionData['tar.name'])
        requestParams["targetTruePosition"] = 'b.o.truePositionAtUT[' + body.id + ',' + positionData["currentUniversalTime"] + ']'
      }
    }

    this.datalink.sendMessage(requestParams, function(data){
      positionData["vesselCurrentPosition"]["truePosition"] = this.truePositionForRelativePosition(
        data["vesselRelativePosition"], data["vesselBodyTruePosition"]
      )

      if(positionData['tar.type']){
github tcannonfodder / houston / static / js / docking_position_data.js View on Github external
this.datalink.sendMessage(requestParams, function(data){
      positionData["vesselCurrentPosition"]["truePosition"] = this.truePositionForRelativePosition(
        data["vesselRelativePosition"], data["vesselBodyTruePosition"]
      )

      if(positionData['tar.type']){
        if(positionData['tar.o.orbitPatches']){
          positionData["targetCurrentPosition"]["truePosition"] = this.truePositionForRelativePosition(
            data["targetRelativePosition"], data["targetBodyTruePosition"]
          )
        } else{
          positionData["targetCurrentPosition"]["truePosition"] = data["targetTruePosition"]
        }
      }

      this.mutexUnlock()
      this.options.onRecalculate && this.options.onRecalculate(positionData)
    }.bind(this))
  },
github tcannonfodder / houston / static / js / orbital_position_data.js View on Github external
getPositionsAndRecalculate: function(positionData){
    var requestParams = {};
    //ask for the true position for the current body right now and the radius
    var referenceBody = this.datalink.getOrbitalBodyInfo(positionData["vesselBody"])
    this.rootReferenceBody = referenceBody
    requestParams["currentReferenceBodyRadius"] = 'b.radius[' + referenceBody.id + ']'
    requestParams["currentReferenceBodyTruePosition"] = 'b.o.truePositionAtUT[' + referenceBody.id + ',' + positionData["currentUniversalTime"] + ']'
    //ask for the relative position of the vessel in the current orbit patch at the current time
    requestParams["vesselCurrentPositionRelativePosition"] = "o.relativePositionAtUTForOrbitPatch[" + 0 +","+ positionData["currentUniversalTime"] + "]"

    this.buildRelativePositionRequestsForOrbitPatches(requestParams, "vesselCurrentOrbit", positionData['o.orbitPatches'], positionData["currentUniversalTime"])
    this.buildRelativePositionRequestsForManeuverNodeOrbitPatches(requestParams, "vesselManeuverNodes", positionData['o.maneuverNodes'], positionData["currentUniversalTime"])

    if(positionData['tar.type']){
      if(positionData['tar.o.orbitPatches'] && positionData['tar.o.orbitPatches'].length > 0){
        this.buildRelativePositionRequestsForOrbitPatches(requestParams, "targetCurrentOrbit", positionData['tar.o.orbitPatches'], positionData["currentUniversalTime"], 'tar.o')
        requestParams["targetCurrentPositionRelativePosition"] = "tar.o.relativePositionAtUTForOrbitPatch[" + 0 +","+ positionData["currentUniversalTime"] + "]"
      } else{
        var body = this.datalink.getOrbitalBodyInfo(positionData['tar.name'])
        requestParams[body.name + "[metadata]radius"] = 'b.radius[' + body.id + ']'
        requestParams[body.name + "["+ positionData["currentUniversalTime"] +"]TruePosition"] = 'b.o.truePositionAtUT[' + body.id + ',' + positionData["currentUniversalTime"] + ']'
        requestParams[body.name + "[metadata]currentTruePosition"] = 'b.o.truePositionAtUT[' + body.id + ',' + positionData["currentUniversalTime"] + ']'
      }
    }

    this.datalink.sendMessage(requestParams, function(data){
      positionData["currentReferenceBodyRadius"] = data["currentReferenceBodyRadius"]
      positionData["currentReferenceBodyTruePosition"] = data["currentReferenceBodyTruePosition"]

      this.buildReferenceBodyPositionData(data, positionData)
      this.buildReferenceBodyMetadata(data, positionData)
github tcannonfodder / houston / public / assets / js / position_data_formatter.js View on Github external
formatTargetOrbitPatches: function(positionData, formattedData){
    if(!positionData['tar.type']){ return }
    if(positionData["tar.o.orbitPatches"].length > 0){
      formattedData.orbitPatches = formattedData.orbitPatches.concat(this.formatOrbitPatches(
        formattedData, positionData, positionData["tar.o.orbitPatches"], {
          type: "orbitPatch",
          parentType: "targetVessel",
          parentName: positionData["tar.name"]
        },{ linkedPatchType: "orbitPatch" }
      ))
    }
  },