void FractionInput::setValue( const MixedNumber &m, double amount_offset ) { MixedNumber second = m + amount_offset; MixedNumberRange range; range.first = m; range.second = range.first + amount_offset; setValueRange( range ); }
void VolumeModel::init(const ModelInfo::Params & params) { AbstractModelWithPoints::init(params); VolumeInfo::PhysicalSize physicalSize = params["physicalSize"].value<VolumeInfo::PhysicalSize>(); VolumeInfo::Size size = params["size"].value<VolumeInfo::Size>(); VolumeInfo::Scaling scaling = params["scaling"].value<VolumeInfo::Scaling>(); scale(scaling); setSlope(params["slope"].value<VolumeInfo::Slope>()); setIntercept(params["intercept"].value<VolumeInfo::Intercept>()); setWindowCenter(params["windowCenter"].value<VolumeInfo::WindowCenter>()); setWindowWidth(params["windowWidth"].value<VolumeInfo::WindowWidth>()); setHuRange(params["huRange"].value<VolumeInfo::HuRange>()); setValueRange(params["valueRange"].value<VolumeInfo::ValueRange>()); ModelInfo::VerticesVTPtr vertices = new ModelInfo::VerticesVT; ModelInfo::IndicesPtr indices = new ModelInfo::Indices; GLfloat scalingFactor = (GLfloat) scene()->scalingFactor(); GLfloat zCurrent = - physicalSize.z() * scaling.z() / scalingFactor / 2.0f; GLfloat step = - (zCurrent * 2.0f) / size.z(); GLfloat stepTexture = 1.0f / size.z(); GLfloat zCurrentTexture = 0.0f; GLfloat w = physicalSize.x() / 2.0f * scaling.x() / scalingFactor; GLfloat h = physicalSize.y() / 2.0f * scaling.y() / scalingFactor; for (int i = 0; i != (int) size.z(); ++ i) { vertices->push_back(ModelInfo::VertexVT(- w, - h, zCurrent, 0.0f, 1.0f, zCurrentTexture)); vertices->push_back(ModelInfo::VertexVT(- w, h, zCurrent, 0.0f, 0.0f, zCurrentTexture)); vertices->push_back(ModelInfo::VertexVT(w, h, zCurrent, 1.0f, 0.0f, zCurrentTexture)); vertices->push_back(ModelInfo::VertexVT(w, - h, zCurrent, 1.0f, 1.0f, zCurrentTexture)); indices->push_back(4 * i); indices->push_back(4 * i + 2); indices->push_back(4 * i + 1); indices->push_back(4 * i); indices->push_back(4 * i + 3); indices->push_back(4 * i + 2); zCurrent += step; zCurrentTexture += stepTexture; }; ModelInfo::BuffersVT buffers; buffers.vertices = ModelInfo::VerticesVTPointer(vertices); buffers.indices = ModelInfo::IndicesPointer(indices); fillBuffers<ModelInfo::BuffersVT>(buffers); }
void ofxTLNotes::trimToPitches(){ if(keyframes.size() == 0) return; // set range to first note pitch ofxTLNote* switchKey = (ofxTLNote*)keyframes[0]; ofRange newRange = ofRange(switchKey->pitch, switchKey->pitch); // iterate through all keys, expand to fit pitches for(int i = 1; i < keyframes.size(); i++){ switchKey = (ofxTLNote*)keyframes[i]; newRange.min = MIN(newRange.min, switchKey->pitch); newRange.max = MAX(newRange.max, switchKey->pitch); } setValueRange(newRange); // fix values of each keyframes for (int i = 0; i < keyframes.size(); ++i) { switchKey = (ofxTLNote*)keyframes[i]; switchKey->value = ofMap(switchKey->pitch, valueRange.min, valueRange.max, 0, 1); } }
void FractionInput::setValue( double d, double amount_offset ) { MixedNumberRange range ( d, amount_offset ); setValueRange( range ); }
KisSmudgeRadiusOption::KisSmudgeRadiusOption(): KisRateOption("SmudgeRadius", KisPaintOpOption::GENERAL, true) { setValueRange(0.0,300.0); }
KisSmudgeOption::KisSmudgeOption(): KisRateOption("SmudgeRate", KisPaintOpOption::GENERAL, true), m_mode(SMEARING_MODE) { setValueRange(0.01, 1.0); }
KisSmudgeRadiusOption::KisSmudgeRadiusOption(const QString& name, const QString& label, bool checked, const QString& category): KisRateOption(name, label, checked, category) { setValueRange(0.0,3.0); }