void AzimuthZenithController::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { if((not m_isDragging) && (event->buttons().testFlag(Qt::LeftButton)) && (m_dragStart - event->scenePos()).manhattanLength() > 3) { qDebug() << (m_dragStart - event->scenePos()).manhattanLength(); m_isDragging = true; } if(not m_isDragging) return; m_azimuthAnimation.stop(); m_zenithAnimation.stop(); // for now, we're just gonna calculate current and // last to emulate the events we used to get. QPointF current = event->scenePos(); QPointF last = event->lastScenePos(); setAzimuth(azimuth() + (float)(current.x() - last.x())/2.0); setZenith(zenith() - (float)(current.y() - last.y())/2.0); m_targetAzimuth = m_azimuth; m_targetZenith = m_zenith; event->accept(); }
void Sun::advanceTime( F32 timeDelta ) { if (mAnimateSun) { if (mCurrTime >= mTotalTime) { mAnimateSun = false; mCurrTime = 0.0f; } else { mCurrTime += timeDelta; F32 fract = mCurrTime / mTotalTime; F32 inverse = 1.0f - fract; F32 newAzimuth = mStartAzimuth * inverse + mEndAzimuth * fract; F32 newElevation = mStartElevation * inverse + mEndElevation * fract; if (newAzimuth > 360.0f) newAzimuth -= 360.0f; if (newElevation > 360.0f) newElevation -= 360.0f; setAzimuth(newAzimuth); setElevation(newElevation); } } }
//------------------------------------------------------------------------------ // Event handlers //------------------------------------------------------------------------------ bool TdAzPtr::onUpdateValue(const base::Number* const msg) { bool ok = false; if (msg != nullptr) { ok = setAzimuth(msg->getReal()); } return ok; }
bool TargetData::setSlotAzimuth(const Basic::Number* const msg) { bool ok = false; if (msg != 0) { ok = setAzimuth(msg->getDouble()); } return ok; }
bool TargetData::setSlotAzimuth(const Basic::Angle* const msg) { bool ok = false; if (msg != 0) { ok = setAzimuth( Basic::Degrees::convertStatic(*msg) ); } return ok; }
void Camera::dragMouse( int x, int y ) { Vec3f mouseDelta = Vec3f(x,y,0.0f) - mLastMousePosition; mLastMousePosition = Vec3f(x,y,0.0f); switch(mCurrentMouseAction) { case kActionTranslate: { calculateViewingTransformParameters(); double xTrack = -mouseDelta[0] * kMouseTranslationXSensitivity; double yTrack = mouseDelta[1] * kMouseTranslationYSensitivity; Vec3f transXAxis = mUpVector ^ (mPosition - mLookAt); transXAxis /= sqrt((transXAxis*transXAxis)); Vec3f transYAxis = (mPosition - mLookAt) ^ transXAxis; transYAxis /= sqrt((transYAxis*transYAxis)); setLookAt(getLookAt() + transXAxis*xTrack + transYAxis*yTrack); break; } case kActionRotate: { float dAzimuth = -mouseDelta[0] * kMouseRotationSensitivity; float dElevation = mouseDelta[1] * kMouseRotationSensitivity; setAzimuth(getAzimuth() + dAzimuth); setElevation(getElevation() + dElevation); if (getAzimuth() > M_PI) mAzimuth -= 2.0*M_PI; if (getElevation() > M_PI) mElevation -= 2.0*M_PI; fprintf(stderr, "az %f, elev %f\n", mAzimuth, mElevation); break; } case kActionZoom: { float dDolly = -mouseDelta[1] * kMouseZoomSensitivity; setDolly(getDolly() + dDolly); break; } case kActionTwist: // Not implemented default: break; } }
int main() { char buffer[200]; int devfilefd, fd, i; float elevation, azimuth; readconfig(); /* open the pseudo terminal device */ fd=getpt(); if (fd<0) { fprintf(stderr, "Unable to open serial line!\n"); return -1; } unlockpt(fd); /* write the device file */ devfilefd = open(PSEUDODEVICEFILE, O_WRONLY|O_CREAT, 0666); write(devfilefd, (char*)ptsname(fd), strlen((char*)ptsname(fd))); close(devfilefd); /* open the fodtrack device */ openfodtrack(fodtrackdev); /* print informations about the devices */ printf("Using %s as pseudo terminal device.\n", ptsname(fd)); printf("Using %s as port for the fodtrack device.\n", fodtrackdev); /* going for the background */ daemon(0,0); /* Main loop - reads from the device, and sets the antenna on the output */ for(;;) { usleep(100); i=read(fd, buffer, 199); if(i>0) { sscanf(buffer, "AZ%f EL%f", &azimuth, &elevation); /*printf("New Data:\nElevation: %f\nAzimuth: %f\n\n", elevation, azimuth);*/ setElevation(elevation); setAzimuth(azimuth); } } }
void QgsMapToolRectangle3Points::cadCanvasMoveEvent( QgsMapMouseEvent *e ) { QgsPoint point = mapPoint( *e ); if ( mTempRubberBand ) { switch ( mPoints.size() ) { case 1: { std::unique_ptr<QgsLineString> line( new QgsLineString() ); line->addVertex( mPoints.at( 0 ) ); line->addVertex( point ); mTempRubberBand->setGeometry( line.release() ); setAzimuth( mPoints.at( 0 ).azimuth( point ) ); setDistance1( mPoints.at( 0 ).distance( point ) ); } break; case 2: { setDistance2( mPoints.at( 1 ).distance( point ) ); int side = QgsGeometryUtils::leftOfLine( point.x(), point.y(), mPoints.at( 0 ).x(), mPoints.at( 0 ).y(), mPoints.at( 1 ).x(), mPoints.at( 1 ).y() ); setSide( side < 0 ? -1 : 1 ); const double xMin = mPoints.at( 0 ).x(); const double xMax = mPoints.at( 0 ).x() + distance2( ); const double yMin = mPoints.at( 0 ).y(); const double yMax = mPoints.at( 0 ).y() + distance1(); const double z = mPoints.at( 0 ).z(); mRectangle = QgsBox3d( xMin, yMin, z, xMax, yMax, z ); mTempRubberBand->setGeometry( QgsMapToolAddRectangle::rectangleToPolygon( true ) ); } break; default: break; } } }
bool RadarGeoCoord_util::calculateGeodesicParam() { if (!this->isPointGeoCoordsSet()){ if (!this->isPointAeqdCoordsSet()) return false; this->AeqdCoords2GeoCoords (); } typedef GeographicLib::Math::real real; const GeographicLib::Geodesic g1= GeographicLib::Geodesic::WGS84(); real LatRad,LonRad, LatPoint, LonPoint, XPoint,Ypoint, Az1,Az2,S12,dummy; LatRad = getLatR(); LonRad = getLonR(); LatPoint = (real)getPointLat(); LonPoint = (real)getPointLon(); dummy = g1.Inverse(LatRad, LonRad,LatPoint,LonPoint, S12,Az1,Az2); if (Math::isnan(Az1)) return false; setSurfaceDistance ((float) S12); setAzimuth((float)Az1); return true; }
AmbisonicRotate::AmbisonicRotate(long anOrder, long aVectorSize) { m_order = Tools::clip_min(anOrder, (long)1); m_number_of_harmonics = 2 * m_order + 1; m_number_of_inputs = m_number_of_harmonics + 1; m_number_of_outputs = m_number_of_harmonics; m_harmonicCos = new double[m_order]; m_harmonicSin = new double[m_order]; computeIndex(); m_cosLookUp = new double[NUMBEROFCIRCLEPOINTS]; m_sinLookUp = new double[NUMBEROFCIRCLEPOINTS]; for (int i = 0; i < NUMBEROFCIRCLEPOINTS; i++) { m_cosLookUp[i] = cos((double)i * CICM_2PI / (double)NUMBEROFCIRCLEPOINTS); m_sinLookUp[i] = sin((double)i * CICM_2PI / (double)NUMBEROFCIRCLEPOINTS); } setAzimuth(0.); setVectorSize(aVectorSize); }
OsmAnd::MapRenderer::MapRenderer() : _taskHostBridge(this) , currentConfiguration(_currentConfiguration) , _currentConfigurationInvalidatedMask(0xFFFFFFFF) , currentState(_currentState) , _currentStateInvalidated(true) , _invalidatedRasterLayerResourcesMask(0) , _invalidatedElevationDataResources(false) , tiledResources(_tiledResources) , _renderThreadId(nullptr) , _workerThreadId(nullptr) , renderAPI(_renderAPI) { _tileRequestsThreadPool.setMaxThreadCount(4); // Create all tiled resources for(auto resourceType = 0u; resourceType < TiledResourceTypesCount; resourceType++) { auto collection = new TiledResources(static_cast<TiledResourceType>(resourceType)); _tiledResources[resourceType].reset(collection); } // Fill-up default state for(auto layerId = 0u; layerId < RasterMapLayersCount; layerId++) setRasterLayerOpacity(static_cast<RasterMapLayerId>(layerId), 1.0f); setElevationDataScaleFactor(1.0f, true); setFieldOfView(16.5f, true); setDistanceToFog(400.0f, true); setFogOriginFactor(0.36f, true); setFogHeightOriginFactor(0.05f, true); setFogDensity(1.9f, true); setFogColor(FColorRGB(1.0f, 0.0f, 0.0f), true); setSkyColor(FColorRGB(140.0f / 255.0f, 190.0f / 255.0f, 214.0f / 255.0f), true); setAzimuth(0.0f, true); setElevationAngle(45.0f, true); const auto centerIndex = 1u << (ZoomLevel::MaxZoomLevel - 1); setTarget(PointI(centerIndex, centerIndex), true); setZoom(0, true); }
Map::Map(unsigned int order, unsigned int numberOfSources) : Ambisonic(order) { assert(numberOfSources > 0); m_number_of_sources = numberOfSources; m_harmonics_float = new float[m_number_of_harmonics]; m_harmonics_double = new double[m_number_of_harmonics]; m_gains = new double[m_number_of_harmonics]; m_muted = new bool[m_number_of_sources]; for(unsigned int i = 0; i < m_number_of_sources; i++) { m_encoders.push_back(new Encoder(order)); m_widers.push_back(new Wider(order)); } m_first_source = 0; for(unsigned int i = 0; i < m_number_of_sources; i++) { setMute(i, 0); setAzimuth(i, 0.); setRadius(i, 1.); } }
void ScatterSky::_updateTimeOfDay( TimeOfDay *timeOfDay, F32 time ) { setElevation( timeOfDay->getElevationDegrees() ); setAzimuth( timeOfDay->getAzimuthDegrees() ); }
void ScatterSky::unpackUpdate(NetConnection *con, BitStream *stream) { Parent::unpackUpdate(con, stream); if ( stream->readFlag() ) // TimeMask { F32 temp = 0; stream->read( &temp ); setAzimuth( temp ); stream->read( &temp ); setElevation( temp ); } if ( stream->readFlag() ) // UpdateMask { stream->read( &mRayleighScattering ); stream->read( &mRayleighScattering4PI ); stream->read( &mMieScattering ); stream->read( &mMieScattering4PI ); stream->read( &mSunSize ); stream->read( &mSkyBrightness ); stream->read( &mMiePhaseAssymetry ); stream->read( &mSphereInnerRadius ); stream->read( &mSphereOuterRadius ); stream->read( &mScale ); ColorF tmpColor( 0, 0, 0 ); stream->read( &tmpColor ); stream->read( &mWavelength4[0] ); stream->read( &mWavelength4[1] ); stream->read( &mWavelength4[2] ); stream->read( &mRayleighScaleDepth ); stream->read( &mMieScaleDepth ); stream->read( &mNightColor ); stream->read( &mNightFogColor ); stream->read( &mAmbientScale ); stream->read( &mSunScale ); stream->read( &mFogScale ); F32 colorizeAmt; stream->read( &colorizeAmt ); if(mColorizeAmt != colorizeAmt) { mColorizeAmt = colorizeAmt; mShader = NULL; //forces shader refresh } stream->read( &mColorize ); if ( tmpColor != mWavelength ) { mWavelength = tmpColor; mWavelength4[0] = mPow(mWavelength[0], 4.0f); mWavelength4[1] = mPow(mWavelength[1], 4.0f); mWavelength4[2] = mPow(mWavelength[2], 4.0f); } stream->read( &mExposure ); stream->read( &mBrightness ); mCastShadows = stream->readFlag(); stream->read( &mFlareScale ); if ( stream->readFlag() ) { SimObjectId id = stream->readRangedU32( DataBlockObjectIdFirst, DataBlockObjectIdLast ); LightFlareData *datablock = NULL; if ( Sim::findObject( id, datablock ) ) mFlareData = datablock; else { con->setLastError( "ScatterSky::unpackUpdate() - invalid LightFlareData!" ); mFlareData = NULL; } } else mFlareData = NULL; mMoonEnabled = stream->readFlag(); stream->read( &mMoonMatName ); stream->read( &mMoonScale ); stream->read( &mMoonTint ); mUseNightCubemap = stream->readFlag(); stream->read( &mNightCubemapName ); stream->read( &mMoonAzimuth ); stream->read( &mMoonElevation ); mLight->unpackExtended( stream ); if ( isProperlyAdded() ) { mDirty = true; _initMoon(); Sim::findObject( mNightCubemapName, mNightCubemap ); } } }
void ViewLightGL::setAzimuth(int azimuth) { setAzimuth(double(azimuth)); }
void AmbisonicRotate::setAzimuthInDegree(double aDegree) { setAzimuth(aDegree / 360. * CICM_2PI); }
void RadarGeoCoord_util::setPointGeodesicCoordinate (float Azimuth, float SurfaceDist, bool cleanOtherCoords) { if (cleanOtherCoords) setPoint2Missing(); setAzimuth(Azimuth); setSurfaceDistance(SurfaceDist); }