void BSymbol::layout() { if (staff()) setMag(staff()->mag(tick())); for (Element* e : _leafs) e->layout(); }
void VibratoSegment::layout() { if (staff()) setMag(staff()->mag(tick())); if (isSingleType() || isBeginType()) { switch (vibrato()->vibratoType()) { case Vibrato::Type::GUITAR_VIBRATO: symbolLine(SymId::guitarVibratoStroke, SymId::guitarVibratoStroke); break; case Vibrato::Type::GUITAR_VIBRATO_WIDE: symbolLine(SymId::guitarWideVibratoStroke, SymId::guitarWideVibratoStroke); break; case Vibrato::Type::VIBRATO_SAWTOOTH: symbolLine(SymId::wiggleSawtooth, SymId::wiggleSawtooth); break; case Vibrato::Type::VIBRATO_SAWTOOTH_WIDE: symbolLine(SymId::wiggleSawtoothWide, SymId::wiggleSawtoothWide); break; } } else symbolLine(SymId::wiggleVibrato, SymId::wiggleVibrato); autoplaceSpannerSegment(spatium() * 1.0); }
void VibratoSegment::layout() { if (staff()) setMag(staff()->mag(tick())); if (spanner()->placeBelow()) rypos() = staff() ? staff()->height() : 0.0; if (isSingleType() || isBeginType()) { switch (vibrato()->vibratoType()) { case Vibrato::Type::GUITAR_VIBRATO: symbolLine(SymId::guitarVibratoStroke, SymId::guitarVibratoStroke); break; case Vibrato::Type::GUITAR_VIBRATO_WIDE: symbolLine(SymId::guitarWideVibratoStroke, SymId::guitarWideVibratoStroke); break; case Vibrato::Type::VIBRATO_SAWTOOTH: symbolLine(SymId::wiggleSawtooth, SymId::wiggleSawtooth); break; case Vibrato::Type::VIBRATO_SAWTOOTH_WIDE: symbolLine(SymId::wiggleSawtoothWide, SymId::wiggleSawtoothWide); break; } } else symbolLine(SymId::wiggleVibrato, SymId::wiggleVibrato); if (isStyled(Pid::OFFSET)) roffset() = vibrato()->propertyDefault(Pid::OFFSET).toPointF(); autoplaceSpannerSegment(); }
DeepSkyObject::DeepSkyObject( const CatalogEntryData &data, CatalogComponent *cat ) { // FIXME: This assumes that CatalogEntryData coordinates have // J2000.0 as epoch as opposed to the catalog's epoch!!! -- asimha qWarning() << "Creating a DeepSkyObject from CatalogEntryData assumes that coordinates are J2000.0"; setType( data.type ); setRA0( data.ra/15.0 ); // NOTE: CatalogEntryData stores RA in degrees, whereas setRA0() wants it in hours. setDec0( data.dec ); setLongName( data.long_name ); if( ! data.catalog_name.isEmpty() ) setName( data.catalog_name + ' ' + QString::number( data.ID ) ); else { setName( data.long_name ); setLongName( QString() ); } MajorAxis = data.major_axis; MinorAxis = data.minor_axis; PositionAngle = data.position_angle; setMag( data.magnitude ); PGC = 0; UGC = 0; setCatalog( data.catalog_name ); updateID = updateNumID = 0; customCat = cat; Flux = data.flux; // Disable image loading on init //loadImage(); }
void TrillSegment::layout() { if (staff()) setMag(staff()->mag(tick())); if (isSingleType() || isBeginType()) { Accidental* a = trill()->accidental(); if (a) { a->layout(); a->setMag(a->mag() * .6); qreal _spatium = spatium(); a->setPos(_spatium * 1.3, -2.2 * _spatium); a->setParent(this); } switch (trill()->trillType()) { case Trill::Type::TRILL_LINE: symbolLine(SymId::ornamentTrill, SymId::wiggleTrill); break; case Trill::Type::PRALLPRALL_LINE: symbolLine(SymId::wiggleTrill, SymId::wiggleTrill); break; case Trill::Type::UPPRALL_LINE: symbolLine(SymId::ornamentBottomLeftConcaveStroke, SymId::ornamentZigZagLineNoRightEnd, SymId::ornamentZigZagLineWithRightEnd); break; case Trill::Type::DOWNPRALL_LINE: symbolLine(SymId::ornamentLeftVerticalStroke, SymId::ornamentZigZagLineNoRightEnd, SymId::ornamentZigZagLineWithRightEnd); break; } } else symbolLine(SymId::wiggleTrill, SymId::wiggleTrill); autoplaceSpannerSegment(); }
void GlissandoSegment::layout() { if (staff()) setMag(staff()->mag()); QRectF r = QRectF(0.0, 0.0, pos2().x(), pos2().y()).normalized(); qreal lw = spatium() * glissando()->lineWidth().val() * .5; setbbox(r.adjusted(-lw, -lw, lw, lw)); adjustReadPos(); }
void KSAsteroid::findMagnitude(const KSNumbers*) { double param = 5 * log10(rsun() * rearth() ); double phase_rad = phase().radians(); double phi1 = exp( -3.33 * pow( tan( phase_rad / 2 ), 0.63 ) ); double phi2 = exp( -1.87 * pow( tan( phase_rad / 2 ), 1.22 ) ); setMag( H + param - 2.5 * log( (1 - G) * phi1 + G * phi2 ) ); }
void TrillSegment::layout() { if (autoplace()) setUserOff(QPointF()); if (staff()) setMag(staff()->mag(tick())); if (isSingleType() || isBeginType()) { Accidental* a = trill()->accidental(); if (a) { a->layout(); a->setMag(a->mag() * .6); qreal _spatium = spatium(); a->setPos(_spatium * 1.3, -2.2 * _spatium); a->setParent(this); } switch (trill()->trillType()) { case Trill::Type::TRILL_LINE: symbolLine(SymId::ornamentTrill, SymId::wiggleTrill); break; case Trill::Type::PRALLPRALL_LINE: symbolLine(SymId::wiggleTrill, SymId::wiggleTrill); break; case Trill::Type::UPPRALL_LINE: symbolLine(SymId::ornamentBottomLeftConcaveStroke, SymId::ornamentZigZagLineNoRightEnd, SymId::ornamentZigZagLineWithRightEnd); break; case Trill::Type::DOWNPRALL_LINE: symbolLine(SymId::ornamentLeftVerticalStroke, SymId::ornamentZigZagLineNoRightEnd, SymId::ornamentZigZagLineWithRightEnd); break; } } else symbolLine(SymId::wiggleTrill, SymId::wiggleTrill); if (parent()) { qreal yo = score()->styleP(trill()->placeBelow() ? Sid::trillPosBelow : Sid::trillPosAbove); rypos() = yo; if (autoplace()) { qreal minDistance = spatium(); Shape s1 = shape().translated(pos()); if (trill()->placeAbove()) { qreal d = system()->topDistance(staffIdx(), s1); if (d > -minDistance) rUserYoffset() = -d - minDistance; } else { qreal d = system()->bottomDistance(staffIdx(), s1); if (d > -minDistance) rUserYoffset() = d + minDistance; } } } }
void StarObject::init( const deepStarData *stardata ) { double ra, dec, BV_Index; ra = stardata->RA / 1000000.0; dec = stardata->Dec / 100000.0; setType( SkyObject::STAR ); if( stardata->V == 30000 && stardata->B != 30000 ) setMag( ( stardata->B - 1600 ) / 1000.0 ); // FIXME: Is it okay to make up stuff like this? else setMag( stardata->V / 1000.0 ); setRA0( ra ); setDec0( dec ); setRA( ra ); setDec( dec ); SpType[1] = '?'; SpType[0] = 'B'; if( stardata->B == 30000 || stardata->V == 30000 ) { BV_Index = -100; SpType[0] = '?'; } else { BV_Index = ( stardata->B - stardata->V ) / 1000.0; ( BV_Index > 0.0 ) && ( SpType[0] = 'A' ); ( BV_Index > 0.325 ) && ( SpType[0] = 'F' ); ( BV_Index > 0.575 ) && ( SpType[0] = 'G' ); ( BV_Index > 0.975 ) && ( SpType[0] = 'K' ); ( BV_Index > 1.6 ) && ( SpType[0] = 'M' ); } PM_RA = stardata->dRA / 100.0; PM_Dec = stardata->dDec / 100.0; Parallax = 0.0; Multiplicity = 0; Variability = 0; updateID = updateNumID = 0; B = stardata->B / 1000.0; V = stardata->V / 1000.0; }
void KSPlanetBase::findMagnitude(const KSNumbers *num) { double cosDec, sinDec; dec()->SinCos(cosDec, sinDec); /* Phase of the planet in degrees */ double earthSun = 1.; double cosPhase = (rsun()*rsun() + rearth()*rearth() - earthSun*earthSun) / (2 * rsun() * rearth() ); double phase = acos ( cosPhase ) * 180.0 / dms::PI; /* Computation of the visual magnitude (V band) of the planet. * Algorithm provided by Pere Planesas (Observatorio Astronomico Nacional) * It has some simmilarity to J. Meeus algorithm in Astronomical Algorithms, Chapter 40. * */ // Initialized to the faintest magnitude observable with the HST float magnitude = 30; double param = 5 * log10(rsun() * rearth() ); double f1 = phase/100.; if ( name() == "Mercury" ) { if ( phase > 150. ) f1 = 1.5; magnitude = -0.36 + param + 3.8*f1 - 2.73*f1*f1 + 2*f1*f1*f1; } if ( name() =="Venus") magnitude = -4.29 + param + 0.09*f1 + 2.39*f1*f1 - 0.65*f1*f1*f1; if( name() == "Mars") magnitude = -1.52 + param + 0.016*phase; if( name() == "Jupiter") magnitude = -9.25 + param + 0.005*phase; if( name() == "Saturn") { double T = num->julianCenturies(); double a0 = (40.66-4.695*T)* dms::PI / 180.; double d0 = (83.52+0.403*T)* dms::PI / 180.; double sinx = -cos(d0)*cosDec*cos(a0 - ra()->radians()); sinx = fabs(sinx-sin(d0)*sinDec); double rings = -2.6*sinx + 1.25*sinx*sinx; magnitude = -8.88 + param + 0.044*phase + rings; } if( name() == "Uranus") magnitude = -7.19 + param + 0.0028*phase; if( name() == "Neptune") magnitude = -6.87 + param; if( name() == "Pluto" ) magnitude = -1.01 + param + 0.041*phase; setMag(magnitude); }
DeepSkyObject::DeepSkyObject( const DeepSkyObject &o ) : SkyObject( o ) , PositionAngle( o.PositionAngle ) , m_image( o.m_image ) , UGC( o.UGC ) , PGC( o.PGC ) , MajorAxis( o.MajorAxis ) , MinorAxis( o.MinorAxis ) , Catalog( o.Catalog ) { customCat = NULL; Flux = o.flux(); setMag( o.mag() ); updateID = updateNumID = 0; }
void StarObject::init( const starData *stardata ) { double ra, dec; ra = stardata->RA / 1000000.0; dec = stardata->Dec / 100000.0; setType( SkyObject::STAR ); setMag( stardata->mag / 100.0 ); setRA0( ra ); setDec0( dec ); setRA( ra ); setDec( dec ); SpType[0] = stardata->spec_type[0]; SpType[1] = stardata->spec_type[1]; PM_RA = stardata->dRA / 10.0; PM_Dec = stardata->dDec / 10.0; Parallax = stardata->parallax / 10.0; Multiplicity = stardata->flags & 0x02; Variability = stardata->flags & 0x04 ; updateID = updateNumID = 0; HD = stardata->HD; B = V = 99.9; // DEBUG Edit. For testing proper motion. Uncomment all related blocks to test. // WARNING: You can debug only ONE STAR AT A TIME, because // the StarObject::Trail is static. It has to be // static, because otherwise, we can run into segfaults // due to the memcpy() that we do to create stars /* testStar = false; if( stardata->HD == 103095 && Trail.size() == 0 ) { // Populate Trail with various positions kDebug() << "TEST STAR FOUND!"; testStar = true; KSNumbers num( J2000 ); // Some estimate, doesn't matter. long double jy; for( jy = -10000.0; jy <= 10000.0; jy += 500.0 ) { num.updateValues( J2000 + jy * 365.238 ); double ra, dec; getIndexCoords( &num, &ra, &dec ); Trail.append( new SkyPoint( ra / 15.0, dec ) ); } kDebug() << "Populated the star's trail with " << Trail.size() << " entries."; } */ // END DEBUG. }
void TrillSegment::layout() { if (parent()) rypos() += score()->styleS(StyleIdx::trillY).val() * spatium(); if (staff()) setMag(staff()->mag()); if (spannerSegmentType() == SpannerSegmentType::SINGLE || spannerSegmentType() == SpannerSegmentType::BEGIN) { Accidental* a = trill()->accidental(); if (a) { a->layout(); a->setMag(a->mag() * .6); qreal _spatium = spatium(); a->setPos(_spatium * 1.3, -2.2 * _spatium); a->adjustReadPos(); } switch (trill()->trillType()) { case Trill::Type::TRILL_LINE: symbolLine(SymId::ornamentTrill, SymId::wiggleTrill); break; case Trill::Type::PRALLPRALL_LINE: symbolLine(SymId::wiggleTrill, SymId::wiggleTrill); break; case Trill::Type::UPPRALL_LINE: if (score()->scoreFont()->isValid(SymId::ornamentBottomLeftConcaveStroke)) symbolLine(SymId::ornamentBottomLeftConcaveStroke, SymId::ornamentZigZagLineNoRightEnd, SymId::ornamentZigZagLineWithRightEnd); else symbolLine(SymId::ornamentUpPrall, // SymId::ornamentZigZagLineNoRightEnd, SymId::ornamentZigZagLineWithRightEnd); SymId::ornamentZigZagLineNoRightEnd); break; case Trill::Type::DOWNPRALL_LINE: if (score()->scoreFont()->isValid(SymId::ornamentLeftVerticalStroke)) symbolLine(SymId::ornamentLeftVerticalStroke, SymId::ornamentZigZagLineNoRightEnd, SymId::ornamentZigZagLineWithRightEnd); else symbolLine(SymId::ornamentDownPrall, // SymId::ornamentZigZagLineNoRightEnd, SymId::ornamentZigZagLineWithRightEnd); SymId::ornamentZigZagLineNoRightEnd); break; } } else symbolLine(SymId::wiggleTrill, SymId::wiggleTrill); adjustReadPos(); }
void Vector::reset(double n1, double n2, Mode form) { mode = form; if (form == RECT) { x = n1; y = n2; setMag(); setAngle(); } else if (form == POL) { mag = n1; angle = n2 / Rad_to_deg; setX(); setY(); } else { cerr << "Incorrect 3rd argument to Vector -- " << "vector set to 0\n"; x = y = mag = angle = 0.0; mode = RECT; } }
bool Tracks::getMag() { setMag(); int start; std::string output; getData(4); usleep(_delay); while(ros::ok()) { readData(output,1); if(output[0]==0x00) break; } this->readData(output, 5 + 5*sensor_used); output.insert(output.begin(),0x00); std::string buff; float value; buff = output.substr(0,4); value = dataToFloat32(buff); std::string payload = output.substr(0,sensor_used*5+4); unsigned short crc = (unsigned short)output[sensor_used*5+4]<<8; crc +=output[sensor_used*5+5]; unsigned short crc_cal = getCRC16(payload); if(crc!=crc_cal) return false; printf("crc: %x %x ",crc,crc_cal); //int cast = reinterpret_cast<int>(value); printf("Mag : %x %x %x %x \n",(unsigned char)buff[0],(unsigned char)buff[1],(unsigned char)buff[2],(unsigned char)buff[3]); int j=magX; for(start = 4;start<(sensor_used*5+1);start+=5) { buff = output.substr(start,5); value = dataToFloat32(buff); printf("%x %x %x %x %x\t\t",(unsigned char)buff[0],(unsigned char)buff[1],(unsigned char)buff[2],(unsigned char)buff[3],(unsigned char)buff[4]); std::cout<<value<<"\n"; _data.data[j++]=value; } std::cout<<std::endl; return true; }
void Accidental::layout() { el.clear(); QRectF r; // don't show accidentals for tab or slash notation if ((staff() && staff()->isTabStaff()) || (note() && note()->fixed())) { setbbox(r); return; } qreal m = parent() ? parent()->mag() : 1.0; if (_small) m *= score()->styleD(StyleIdx::smallNoteMag); setMag(m); m = magS(); if (_hasBracket) { SymElement e(SymId::accidentalParensLeft, 0.0); el.append(e); r |= symBbox(SymId::accidentalParensLeft); } SymId s = symbol(); qreal x = r.x()+r.width(); SymElement e(s, x); el.append(e); r |= symBbox(s).translated(x, 0.0); if (_hasBracket) { x = r.x()+r.width(); SymElement e(SymId::accidentalParensRight, x); el.append(e); r |= symBbox(SymId::accidentalParensRight).translated(x, 0.0); } setbbox(r); }
void Accidental::layout() { el.clear(); QRectF r; if (staff() && staff()->isTabStaff()) { //in TAB, accidentals are not shown setbbox(QRectF()); return; } qreal m = parent() ? parent()->mag() : 1.0; if (_small) m *= score()->styleD(ST_smallNoteMag); setMag(m); m = magS(); if (_hasBracket) { SymElement e(SymId::noteheadParenthesisLeft, 0.0); el.append(e); r |= symBbox(SymId::noteheadParenthesisLeft); } SymId s = symbol(); qreal x = r.x()+r.width(); SymElement e(s, x); el.append(e); r |= symBbox(s).translated(x, 0.0); if (_hasBracket) { x = r.x()+r.width(); SymElement e(SymId::noteheadParenthesisRight, x); el.append(e); r |= symBbox(SymId::noteheadParenthesisRight).translated(x, 0.0); } setbbox(r); }
void KSPluto::findMagnitude(const KSNumbers*) { setMag( -1.01 + 5*log10(rsun() * rearth()) + 0.041*phase().Degrees() ); }