deg
Definition
-- @/deg:-1
function deg(...)
Callers
@/lua/vehicle/extensions/mqttGrafanaDemo.lua
if wd.steerAxisUp and wd.steerAxisDown then
wheelData.caster = deg(acos(obj:nodeVecPlanarCos(wd.steerAxisUp, wd.steerAxisDown, vectorUp, vectorForward)))
wheelData.sai = deg(acos(obj:nodeVecPlanarCos(wd.steerAxisUp, wd.steerAxisDown, vectorUp, vectorRight)))
wheelData.caster = deg(acos(obj:nodeVecPlanarCos(wd.steerAxisUp, wd.steerAxisDown, vectorUp, vectorForward)))
wheelData.sai = deg(acos(obj:nodeVecPlanarCos(wd.steerAxisUp, wd.steerAxisDown, vectorUp, vectorRight)))
end
--local camberSign = obj:nodeVecCos(wd.node2, wd.node2, vectorForward) --unused
wheelData.camber = (90 - deg(acos(obj:nodeVecPlanarCos(wd.node2, wd.node1, vectorUp, vectorRight))))
local toeSign = obj:nodeVecCos(wd.node1, wd.node2, vectorForward)
local toeSign = obj:nodeVecCos(wd.node1, wd.node2, vectorForward)
wheelData.toe = deg(acos(obj:nodeVecPlanarCos(wd.node1, wd.node2, vectorRight, vectorForward)))
if wheelData.toe > 90 then
@/lua/ge/extensions/editor/toolUtilities/render.lua
local function markupObstacleDistanceWithElevation(pos, dist, elevDiff) drawMarkupCulledAlwaysShow(pos, string.format('[Obstacle: %.1f m; dZ = %.1fm]', dist, elevDiff)) end
local function markupAngleAndDistance(pos, dist, angleRad) drawMarkupCulledAlwaysShow(pos, string.format('%.1f m; %.1f°', dist, deg(angleRad))) end
local function markupAngleDistanceWithElevation(pos, dist, angleRad, elevDiff) drawMarkupCulledAlwaysShow(pos, string.format('%.1f m; %.1f°; dZ = %.1fm', dist, deg(angleRad), elevDiff)) end
local function markupAngleAndDistance(pos, dist, angleRad) drawMarkupCulledAlwaysShow(pos, string.format('%.1f m; %.1f°', dist, deg(angleRad))) end
local function markupAngleDistanceWithElevation(pos, dist, angleRad, elevDiff) drawMarkupCulledAlwaysShow(pos, string.format('%.1f m; %.1f°; dZ = %.1fm', dist, deg(angleRad), elevDiff)) end
@/lua/ge/extensions/editor/tech/roadArchitect/render.lua
dbgDraw.drawTextAdvanced(pInt2D, tostring(util.round2(dist)) .. ' m ', textA, true, false, textB)
dbgDraw.drawTextAdvanced(pInt2D, tostring(util.round2(deg(theta1))) .. ' ° ', textA, true, false, textB)
local vec5 = v1 * 5.0
dbgDraw.drawTextAdvanced(pInt2D, tostring(util.round2(dist)) .. ' m ', textA, true, false, textB)
dbgDraw.drawTextAdvanced(pInt2D, tostring(util.round2(deg(theta2))) .. ' ° ', textA, true, false, textB)
local vec5 = v1 * 5.0
@/lua/vehicle/recovery.lua
local dirLeft = dirUp:cross(dirFront)
local roll = math.deg(math.asin(dirLeft.z))
local pitch = math.deg(math.asin(dirFront.z))
local roll = math.deg(math.asin(dirLeft.z))
local pitch = math.deg(math.asin(dirFront.z))
if dirUp.z < 0 then -- if we are closer to upside down than to downside up
-- detect the "on its roof" situation, where angles are zero, and make sure they go all the way to 180deg instead, like this:
-- original rotation angles: 0deg (ok), 90deg (halfway), 0deg (on its roof), -90deg (halfway), 0deg (ok)
-- corrected rotation angles: 0deg (ok), 90deg (halfway), +/-180deg (on its roof), -90deg (halfway), 0deg (ok)
-- detect the "on its roof" situation, where angles are zero, and make sure they go all the way to 180deg instead, like this:
-- original rotation angles: 0deg (ok), 90deg (halfway), 0deg (on its roof), -90deg (halfway), 0deg (ok)
-- corrected rotation angles: 0deg (ok), 90deg (halfway), +/-180deg (on its roof), -90deg (halfway), 0deg (ok)
-- detect the "on its roof" situation, where angles are zero, and make sure they go all the way to 180deg instead, like this:
-- original rotation angles: 0deg (ok), 90deg (halfway), 0deg (on its roof), -90deg (halfway), 0deg (ok)
-- corrected rotation angles: 0deg (ok), 90deg (halfway), +/-180deg (on its roof), -90deg (halfway), 0deg (ok)
-- detect the "on its roof" situation, where angles are zero, and make sure they go all the way to 180deg instead, like this:
-- original rotation angles: 0deg (ok), 90deg (halfway), 0deg (on its roof), -90deg (halfway), 0deg (ok)
-- corrected rotation angles: 0deg (ok), 90deg (halfway), +/-180deg (on its roof), -90deg (halfway), 0deg (ok)
-- detect the "on its roof" situation, where angles are zero, and make sure they go all the way to 180deg instead, like this:
-- original rotation angles: 0deg (ok), 90deg (halfway), 0deg (on its roof), -90deg (halfway), 0deg (ok)
-- corrected rotation angles: 0deg (ok), 90deg (halfway), +/-180deg (on its roof), -90deg (halfway), 0deg (ok)
-- original rotation angles: 0deg (ok), 90deg (halfway), 0deg (on its roof), -90deg (halfway), 0deg (ok)
-- corrected rotation angles: 0deg (ok), 90deg (halfway), +/-180deg (on its roof), -90deg (halfway), 0deg (ok)
roll = sign( roll)*(180 - math.abs( roll))
-- original rotation angles: 0deg (ok), 90deg (halfway), 0deg (on its roof), -90deg (halfway), 0deg (ok)
-- corrected rotation angles: 0deg (ok), 90deg (halfway), +/-180deg (on its roof), -90deg (halfway), 0deg (ok)
roll = sign( roll)*(180 - math.abs( roll))
-- original rotation angles: 0deg (ok), 90deg (halfway), 0deg (on its roof), -90deg (halfway), 0deg (ok)
-- corrected rotation angles: 0deg (ok), 90deg (halfway), +/-180deg (on its roof), -90deg (halfway), 0deg (ok)
roll = sign( roll)*(180 - math.abs( roll))
-- original rotation angles: 0deg (ok), 90deg (halfway), 0deg (on its roof), -90deg (halfway), 0deg (ok)
-- corrected rotation angles: 0deg (ok), 90deg (halfway), +/-180deg (on its roof), -90deg (halfway), 0deg (ok)
roll = sign( roll)*(180 - math.abs( roll))
-- original rotation angles: 0deg (ok), 90deg (halfway), 0deg (on its roof), -90deg (halfway), 0deg (ok)
-- corrected rotation angles: 0deg (ok), 90deg (halfway), +/-180deg (on its roof), -90deg (halfway), 0deg (ok)
roll = sign( roll)*(180 - math.abs( roll))
@/lua/ge/extensions/core/vehicle/partmgmt.lua
z = roundNear(offsetPos.z, 0.001),
rx = roundNear(math.deg(offsetEuler.x), 0.1),
ry = roundNear(math.deg(offsetEuler.y), 0.1),
rx = roundNear(math.deg(offsetEuler.x), 0.1),
ry = roundNear(math.deg(offsetEuler.y), 0.1),
rz = roundNear(math.deg(offsetEuler.z), 0.1),
ry = roundNear(math.deg(offsetEuler.y), 0.1),
rz = roundNear(math.deg(offsetEuler.z), 0.1),
}
entry.offsetData.offset = {
rx = roundNear(math.deg(offsetEuler.x), 0.1),
ry = roundNear(math.deg(offsetEuler.y), 0.1),
rx = roundNear(math.deg(offsetEuler.x), 0.1),
ry = roundNear(math.deg(offsetEuler.y), 0.1),
rz = roundNear(math.deg(offsetEuler.z), 0.1),
ry = roundNear(math.deg(offsetEuler.y), 0.1),
rz = roundNear(math.deg(offsetEuler.z), 0.1),
}
@/lua/vehicle/hydros.lua
local softlockForceCoef = 1
local softlockDegrees = 40 -- in these last degrees of steering range, we apply forces to keep the USB steering wheel within the vlua steering lock. e.g. if driving a 360deg Bolide with a 900deg logitech wheel, then from 320 to 360deg (and beyond) the logitech will start pushing back
local softlockThreshold = nil
@/lua/ge/extensions/ui/uiNavi.lua
mapObj.pos[1], mapObj.pos[2], mapObj.pos[3] = v.pos.x, v.pos.y, v.pos.z
mapObj.rot = math.deg(math.atan2(v.dirVec:dot(xPlus), v.dirVec:dot(yMinus)))
mapObj.speed = v.vel:length()
-- --v.vel = v.vel:toTable()
-- rot = math.deg(math.atan2(dir:dot(xPlus), dir:dot(yMinus))),
-- --v.dirVec = v.dirVec:toTable()
@/lua/ge/extensions/gameplay/rally/geometry.lua
local angleRad = acos(clamp(angleCos, -1, 1))
local angle = deg(angleRad)*2
@/lua/ge/extensions/core/cameraModes/driver.lua
end
self.camRot:set(math.deg(rot.x), math.deg(rot.y) - seatRotation, math.deg(rot.z))
left:set(data.veh:getNodePositionXYZ(self.refNodes.left))
end
self.camRot:set(math.deg(rot.x), math.deg(rot.y) - seatRotation, math.deg(rot.z))
left:set(data.veh:getNodePositionXYZ(self.refNodes.left))
end
self.camRot:set(math.deg(rot.x), math.deg(rot.y) - seatRotation, math.deg(rot.z))
left:set(data.veh:getNodePositionXYZ(self.refNodes.left))
@/lua/vehicle/controller/gauges/customModules/navigationData.lua
local dir = obj:getDirectionVector()
mapData.rotation = deg(atan2(dir:dot(vecX), dir:dot(vecY)))
gaugeHTMLTexture:streamJS("updateMap", "updateMap", mapData)
@/lua/ge/extensions/flowgraph/nodes/scene/camera/cameraCircle.lua
local dirVec = veh:getDirectionVector()
self.angle = self.angle + math.deg(math.atan2(dirVec.x, dirVec.y))
end
@/lua/ge/extensions/gameplay/rally/notebook/pacenoteGenerator.lua
local angleRad = acos(clamp(angleCos, -1, 1))
local angle = deg(angleRad) * 2
@/lua/common/jbeam/utils.lua
local eulerRot = tmpMat1:toEuler()
return tmpVec1.x, tmpVec1.y, tmpVec1.z, deg(-eulerRot.x), deg(-eulerRot.y), deg(-eulerRot.z)
else
local eulerRot = tmpMat1:toEuler()
return tmpVec1.x, tmpVec1.y, tmpVec1.z, deg(-eulerRot.x), deg(-eulerRot.y), deg(-eulerRot.z)
else
local eulerRot = tmpMat1:toEuler()
return tmpVec1.x, tmpVec1.y, tmpVec1.z, deg(-eulerRot.x), deg(-eulerRot.y), deg(-eulerRot.z)
else
local eulerRot = tmpMat1:toEuler()
return tmpVec1.x, tmpVec1.y, tmpVec1.z, deg(-eulerRot.x), deg(-eulerRot.y), deg(-eulerRot.z)
else
local eulerRot = tmpMat1:toEuler()
return tmpVec1.x, tmpVec1.y, tmpVec1.z, deg(-eulerRot.x), deg(-eulerRot.y), deg(-eulerRot.z)
else
local eulerRot = tmpMat1:toEuler()
return tmpVec1.x, tmpVec1.y, tmpVec1.z, deg(-eulerRot.x), deg(-eulerRot.y), deg(-eulerRot.z)
else
@/lua/vehicle/controller/sbrGauges.lua
local dir = obj:getDirectionVector():normalized()
mapData.rotation = deg(atan2(dir:dot(vecX), dir:dot(vecY)))
htmlTexture.call(gaugesScreenName, "updateMap", mapData)
@/lua/vehicle/extensions/tech/CANBus/RacingDisplay.lua
local rollAV, pitchAV, yawAV = obj:getRollPitchYawAngularVelocity()
local rollAVByte1, rollAVByte2 = canBus.twoBytes(deg(rollAV) * 10)
local pitchAVByte1, pitchAVByte2 = canBus.twoBytes(deg(pitchAV) * 10)
local rollAVByte1, rollAVByte2 = canBus.twoBytes(deg(rollAV) * 10)
local pitchAVByte1, pitchAVByte2 = canBus.twoBytes(deg(pitchAV) * 10)
local yawAVByte1, yawAVByte2 = canBus.twoBytes(deg(yawAV) * 10)
local pitchAVByte1, pitchAVByte2 = canBus.twoBytes(deg(pitchAV) * 10)
local yawAVByte1, yawAVByte2 = canBus.twoBytes(deg(yawAV) * 10)
vehicleData1Message[1] = accX
local rollAngle, pitchAngle = obj:getRollPitchYaw()
local rollAngleByte1, rollAngleByte2 = canBus.twoBytes(deg(rollAngle) * 10)
local pitchAngleByte1, pitchAngleByte2 = canBus.twoBytes(deg(pitchAngle) * 10)
local rollAngleByte1, rollAngleByte2 = canBus.twoBytes(deg(rollAngle) * 10)
local pitchAngleByte1, pitchAngleByte2 = canBus.twoBytes(deg(pitchAngle) * 10)
vehicleData2Message[1] = vehicleVelocityByte1
@/lua/vehicle/mapmgr.lua
r = r or 2
local hr = 1.2 * r -- calculation is guaranteed to be accurate up to ~ 50 deg (argtan(1.2)) inclination
@/lua/ge/extensions/gameplay/rally/snaproad/geoPacenotes.lua
-- local angleRad = math.acos(math.max(-1, math.min(1, angleCos)))
-- local angle = math.deg(angleRad) * 2
@/lua/vehicle/extensions/tech/trailSim.lua
local trailerDirection = trailerVehicle.dirVec:z0():normalized()
--trailerAngle = deg(acos(vehicleDirection:dot(trailerDirection)))
trailerAngle = deg(atan2(vehicleDirection:cross(trailerDirection):dot(vec3(0, 0, 1)), vehicleDirection:dot(trailerDirection)))
--trailerAngle = deg(acos(vehicleDirection:dot(trailerDirection)))
trailerAngle = deg(atan2(vehicleDirection:cross(trailerDirection):dot(vec3(0, 0, 1)), vehicleDirection:dot(trailerDirection)))
end
data[1][2] = electrics.values.wheelspeed or 0 --vehicle speed
data[2][2] = -deg(frontWheelAngle) --steering wheel angle
data[3][2] = yawAV or 0 --vehicle yaw velocity
@/lua/common/jbeam/sections/mirror.lua
local r = q:toEulerYXZ()
log("E","proc","Migrate "..dumps(v.mesh) .." baseRotationGlobal="..dumps(math.deg(r.y)).."|"..dumps(math.deg(r.z)).."|"..dumps(math.deg(r.x)) )
mirror.normal = v.normal
local r = q:toEulerYXZ()
log("E","proc","Migrate "..dumps(v.mesh) .." baseRotationGlobal="..dumps(math.deg(r.y)).."|"..dumps(math.deg(r.z)).."|"..dumps(math.deg(r.x)) )
mirror.normal = v.normal
local r = q:toEulerYXZ()
log("E","proc","Migrate "..dumps(v.mesh) .." baseRotationGlobal="..dumps(math.deg(r.y)).."|"..dumps(math.deg(r.z)).."|"..dumps(math.deg(r.x)) )
mirror.normal = v.normal
local r = q:toEulerYXZ()
log("E","proc","Migrate "..dumps(v.mesh) .." offsetRotationGlobal="..dumps(math.deg(r.y)).."|"..dumps(math.deg(r.z)).."|"..dumps(math.deg(r.x)) )
mirror.offsetNormal = v.offsetNormal
local r = q:toEulerYXZ()
log("E","proc","Migrate "..dumps(v.mesh) .." offsetRotationGlobal="..dumps(math.deg(r.y)).."|"..dumps(math.deg(r.z)).."|"..dumps(math.deg(r.x)) )
mirror.offsetNormal = v.offsetNormal
local r = q:toEulerYXZ()
log("E","proc","Migrate "..dumps(v.mesh) .." offsetRotationGlobal="..dumps(math.deg(r.y)).."|"..dumps(math.deg(r.z)).."|"..dumps(math.deg(r.x)) )
mirror.offsetNormal = v.offsetNormal
@/lua/vehicle/extensions/advancedwheeldebug.lua
local casterSign = -obj:nodeVecCos(wd.steerAxisUp, wd.steerAxisDown, surfaceForward)
wheelData.caster = deg(acos(obj:nodeVecPlanarCos(wd.steerAxisUp, wd.steerAxisDown, surfaceUp, surfaceForward))) * sign(casterSign)
wheelData.sai = deg(acos(obj:nodeVecPlanarCos(wd.steerAxisUp, wd.steerAxisDown, surfaceUp, surfaceRight)))
wheelData.caster = deg(acos(obj:nodeVecPlanarCos(wd.steerAxisUp, wd.steerAxisDown, surfaceUp, surfaceForward))) * sign(casterSign)
wheelData.sai = deg(acos(obj:nodeVecPlanarCos(wd.steerAxisUp, wd.steerAxisDown, surfaceUp, surfaceRight)))
end
--local camberSign = obj:nodeVecCos(wd.node2, wd.node2, vectorForward) --unused
wheelData.camber = (90 - deg(acos(obj:nodeVecPlanarCos(wd.node2, wd.node1, surfaceUp, surfaceRight))))
local toeSign = obj:nodeVecCos(wd.node1, wd.node2, vehForward)
local toeSign = obj:nodeVecCos(wd.node1, wd.node2, vehForward)
wheelData.toe = deg(acos(obj:nodeVecPlanarCos(wd.node1, wd.node2, vehRight, vehForward)))
if wheelData.toe > 90 then
@/lua/vehicle/extensions/escCalibration.lua
if maxSteerAngleTimer > initWaitingTime then
maxSteerAngle = maxSteerAngle + math.deg(esc.wheelAngleFront)
maxSteerAngleCounter = maxSteerAngleCounter + 1
@/lua/vehicle/powertrain/electricServo.lua
end
--print(string.format("Wanted: %.2f, used %.2f instead, current angle: %.2f", math.deg(angle), math.deg(device.targetAngle), math.deg(device.currentAngle)))
end
end
--print(string.format("Wanted: %.2f, used %.2f instead, current angle: %.2f", math.deg(angle), math.deg(device.targetAngle), math.deg(device.currentAngle)))
end
end
--print(string.format("Wanted: %.2f, used %.2f instead, current angle: %.2f", math.deg(angle), math.deg(device.targetAngle), math.deg(device.currentAngle)))
end
@/lua/ge/extensions/editor/sidewalkSpline/populate.lua
if dot ~= 0 or crossZ ~= 0 then
local angle = deg(atan2(abs(crossZ), dot))
if angle >= pizzaMinAngleDeg then
@/lua/ge/extensions/gameplay/drift/drift.lua
driftAngleDiff = math.deg(math.acos(velDir:cosAngle(driftActiveData.lastFrameVelDir))) -- angle in deg
@/lua/vehicle/controller/beamNavigator.lua
local pos = obj:getPosition()
local rotation = math.deg(obj:getDirection()) + 180
local speed = electrics.values.airspeed * 3.6
@/lua/ge/extensions/editor/masterSpline/homologation.lua
bankComponent = clamp(bankComponent, -1, 1)
local signedBankDeg = deg(asin(bankComponent)) -- The signed bank angle in degrees.
-- Compute signed bank angle (positive = right bank, negative = left bank).
local signedBankDeg = deg(geom.signedAngleBetweenVecs(globalUp, normal, tangent))
@/lua/ge/map.lua
r = r or 2
local hr = 1.2 * r -- calculation is guaranteed to be accurate up to ~ 50 deg (argtan(1.2)) inclination
@/lua/vehicle/extensions/escMeasurement.lua
if maxSteerAngleTimer > initWaitingTime then
maxSteerAngle = maxSteerAngle + math.deg(CMU.vehicleData.frontWheelAngle)
maxSteerAngleCounter = maxSteerAngleCounter + 1
if maxSteerAngleTimer > initWaitingTime then
maxSteerAngle = maxSteerAngle + math.deg(CMU.vehicleData.frontWheelAngle)
maxSteerAngleCounter = maxSteerAngleCounter + 1
@/lua/ge/extensions/core/cameraModes/unicycle.lua
local rotEuler = initialLookDir:toEulerYXZ()
local rotVec = vec3(math.deg(rotEuler.x), 180, 0) -- look horizontally, cause the math below is broken :(
--local rotVec = vec3(math.deg(rotEuler.x), 180+math.deg(rotEuler.y), math.deg(rotEuler.z))
local rotVec = vec3(math.deg(rotEuler.x), 180, 0) -- look horizontally, cause the math below is broken :(
--local rotVec = vec3(math.deg(rotEuler.x), 180+math.deg(rotEuler.y), math.deg(rotEuler.z))
--dump(string.format("%5.3f, %5.3f, %5.3f", rotVec.x, rotVec.y, rotVec.z))
local rotVec = vec3(math.deg(rotEuler.x), 180, 0) -- look horizontally, cause the math below is broken :(
--local rotVec = vec3(math.deg(rotEuler.x), 180+math.deg(rotEuler.y), math.deg(rotEuler.z))
--dump(string.format("%5.3f, %5.3f, %5.3f", rotVec.x, rotVec.y, rotVec.z))
local rotVec = vec3(math.deg(rotEuler.x), 180, 0) -- look horizontally, cause the math below is broken :(
--local rotVec = vec3(math.deg(rotEuler.x), 180+math.deg(rotEuler.y), math.deg(rotEuler.z))
--dump(string.format("%5.3f, %5.3f, %5.3f", rotVec.x, rotVec.y, rotVec.z))