std::string Viewer::UII_ImageResolution(Img::Image::Ptr image) { if(!image || (image->IsHeaderInformationValid() == false && image->IsFinished())) return ""; SizeInt sz = image->GetTransformedSize(); if(IsPositive(sz)) return ToAString(sz.Width) + "x" + ToAString(sz.Height); return ""; }
// 線分と交差する点を取得. IZ_BOOL CPlane::GetIntersectPoint( const SVector4& from, const SVector4& to, SVector4& refPtr, IZ_FLOAT* retRayCoefficient/*= IZ_NULL*/) const { if ((IsPositive(from) && !IsPositive(to)) || (!IsPositive(from) && IsPositive(to))) { // 二つの点は面の正負のそれぞれにないといけない CRay ray( from, CVector4(to, from, CVector4::INIT_SUB)); IZ_BOOL ret = GetIntersectPoint(ray, refPtr, retRayCoefficient); return ret; } return IZ_FALSE; }
void Game_BattleAlgorithm::AlgorithmBase::Apply() { if (GetAffectedHp() != -1) { int hp = GetAffectedHp(); (*current_target)->ChangeHp(IsPositive() ? hp : -hp); } if (GetAffectedSp() != -1) { int sp = GetAffectedSp(); (*current_target)->SetSp((*current_target)->GetSp() + (IsPositive() ? sp : -sp)); } // TODO if (GetAffectedAttack() != -1) { } if (GetAffectedDefense() != -1) { } if (GetAffectedSpirit() != -1) { } if (GetAffectedAgility() != -1) { } // End TODO if (GetAffectedSwitch() != -1) { Game_Switches[GetAffectedSwitch()] = true; } std::vector<RPG::State>::const_iterator it = conditions.begin(); for (; it != conditions.end(); ++it) { if (IsPositive()) { (*current_target)->RemoveState(it->ID); } else { (*current_target)->AddState(it->ID); } } source->SetDefending(false); }
int main(void) { int num; int result; printf("숫자 입력 : "); scanf("%d", &num); result=IsPositive(num); if(result==TRUE) printf("Positive number \n"); else printf("Negative number \n"); return 0; }
Estimate Estimate::TruncateNegative(const char *origin) const { if (IsNegative()) throw DomainException(origin); if (IsPositive()) return *this; // (the theory says // we can't always give the correct DomainException, so we shouldn't try) // Get an interval centered at half the upper bound, with the same error. LongFloat center((m_Value + m_Error.AsLongFloat()) >> 1); Estimate a(center, ErrorEstimate(center)); assert(!a.IsPositive()); return a; //return a.SetError(a); }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool OperandInfo::IsOperandPositive(Operand* op, IntConstant*& intConst) { if(op->IsInteger() == false) { return false; } // Try to use value-range information. if(auto rangeTag = GetRangeTag(op)) { intConst = rangeTag->GetAsConstant(op); if(intConst == nullptr) { // We don't have a constant, but try at least // to determine if the number is positive. if(IsPositive(op, nullptr, 0)) { return true; } } } return false; }
void Viewer::ImageChanged() { UpdateImageInformation(); if (IsMaximized() || m_viewPort.Image() == nullptr) { return; } auto imageSize = m_viewPort.OptimalViewportSize(); if (IsPositive(imageSize) && ViewportMode() == SM_Normal) { if (m_cfg.View.ResizeWindow) { // The window should be resized some way. SizeInt newSize; SizeInt windowEdges = wxToSize(GetSize()) - ClientRect().Dimensions(); if (m_viewPort.ZoomMode() == App::ZoomFitImage) { // The image should _also_ be resized to fit some way. // Make the viewer as large as possible (and needed). //const RectInt& rtDesktop = Win::FindMonitorAt(PositionScreen())->WorkArea(); wxDisplay display(DisplayFromPointFallback(PositionScreen())); auto rtDesktop = wxToRect(display.GetClientArea()); float xratio = static_cast<float>(rtDesktop.Width() - windowEdges.Width) / imageSize.Width; float yratio = static_cast<float>(rtDesktop.Height() - windowEdges.Height) / imageSize.Height; ResizeBehaviour mode = m_cfg.View.ResizeBehaviour; newSize = calculateImageSize(mode, xratio, yratio, imageSize, windowEdges); } else { newSize = calculateCappedImageSize(m_viewPort.ZoomedImageSize(), windowEdges); } PointInt newTopLeft = calculateWindowTopLeft(m_cfg.View.ResizePositionMethod, newSize); m_userInitiatedMove = false; SetSize(newTopLeft.X, newTopLeft.Y, newSize.Width, newSize.Height); m_userInitiatedMove = true; } } }
bool NotPositive() const { return !IsPositive(); }
void Game_BattleAlgorithm::AlgorithmBase::Apply() { if (GetAffectedHp() != -1) { int hp = GetAffectedHp(); int target_hp = (*current_target)->GetHp(); (*current_target)->ChangeHp(IsPositive() ? hp : -hp); if (absorb) { // Only absorb the hp that were left int src_hp = std::min(target_hp, IsPositive() ? -hp : hp); source->ChangeHp(src_hp); } } if (GetAffectedSp() != -1) { int sp = GetAffectedSp(); int target_sp = (*current_target)->GetSp(); (*current_target)->SetSp((*current_target)->GetSp() + (IsPositive() ? sp : -sp)); if (absorb) { int src_sp = std::min(target_sp, IsPositive() ? -sp : sp); source->ChangeSp(src_sp); } } if (GetAffectedAttack() != -1) { int atk = GetAffectedAttack(); (*current_target)->SetAtkModifier(IsPositive() ? atk : -atk); if (absorb) { source->SetAtkModifier(IsPositive() ? -atk : atk); } } if (GetAffectedDefense() != -1) { int def = GetAffectedDefense(); (*current_target)->SetDefModifier(IsPositive() ? def : -def); if (absorb) { source->SetDefModifier(IsPositive() ? -def : def); } } if (GetAffectedSpirit() != -1) { int spi = GetAffectedSpirit(); (*current_target)->SetSpiModifier(IsPositive() ? spi : -spi); if (absorb) { source->SetSpiModifier(IsPositive() ? -spi : spi); } } if (GetAffectedAgility() != -1) { int agi = GetAffectedAgility(); (*current_target)->SetAgiModifier(IsPositive() ? agi : -agi); if (absorb) { source->SetAgiModifier(IsPositive() ? -agi : agi); } } if (GetAffectedSwitch() != -1) { Game_Switches[GetAffectedSwitch()] = true; } std::vector<RPG::State>::const_iterator it = conditions.begin(); for (; it != conditions.end(); ++it) { if (IsPositive()) { if ((*current_target)->IsDead() && it->ID == 1) { // Was a revive skill with an effect rating of 0 (*current_target)->ChangeHp(1); } (*current_target)->RemoveState(it->ID); } else { (*current_target)->AddState(it->ID); } } source->SetDefending(false); }
void Game_BattleAlgorithm::AlgorithmBase::GetResultMessages(std::vector<std::string>& out) const { if (current_target == targets.end()) { return; } if (!success) { out.push_back((*current_target)->GetName() + Data::terms.dodge); } bool target_is_ally = (*current_target)->GetType() == Game_Battler::Type_Ally; if (GetAffectedHp() != -1) { std::stringstream ss; ss << (*current_target)->GetName(); if (IsPositive()) { if (!(*current_target)->IsDead()) { ss << " "; ss << Data::terms.health_points << " " << GetAffectedHp(); ss << Data::terms.hp_recovery; out.push_back(ss.str()); } } else { if (critical_hit) { out.push_back(target_is_ally ? Data::terms.actor_critical : Data::terms.enemy_critical); } if (GetAffectedHp() == 0) { ss << (target_is_ally ? Data::terms.actor_undamaged : Data::terms.enemy_undamaged); } else { if (absorb) { ss << " " << Data::terms.health_points << " " << GetAffectedHp(); ss << (target_is_ally ? Data::terms.actor_hp_absorbed : Data::terms.enemy_hp_absorbed); } else { ss << " " << GetAffectedHp() << (target_is_ally ? Data::terms.actor_damaged : Data::terms.enemy_damaged); } } out.push_back(ss.str()); } } if (GetAffectedSp() != -1) { std::stringstream ss; ss << (*current_target)->GetName(); if (IsPositive()) { ss << " "; ss << Data::terms.spirit_points << " " << GetAffectedSp(); ss << Data::terms.hp_recovery; } else { if (absorb) { ss << " " << Data::terms.spirit_points << " " << GetAffectedSp(); ss << (target_is_ally ? Data::terms.actor_hp_absorbed : Data::terms.enemy_hp_absorbed); } else { ss << " " << Data::terms.attack << " " << GetAffectedSp(); } } out.push_back(ss.str()); } if (GetAffectedAttack() != -1) { std::stringstream ss; ss << (*current_target)->GetName(); ss << " " << Data::terms.attack << " " << GetAffectedSp(); out.push_back(ss.str()); } if (GetAffectedDefense() != -1) { std::stringstream ss; ss << (*current_target)->GetName(); ss << " " << Data::terms.defense << " " << GetAffectedDefense(); out.push_back(ss.str()); } if (GetAffectedSpirit() != -1) { std::stringstream ss; ss << (*current_target)->GetName(); ss << " " << Data::terms.spirit << " " << GetAffectedSpirit(); out.push_back(ss.str()); } if (GetAffectedAgility() != -1) { std::stringstream ss; ss << (*current_target)->GetName(); ss << " " << Data::terms.agility << " " << GetAffectedAgility(); out.push_back(ss.str()); } std::vector<RPG::State>::const_iterator it = conditions.begin(); for (; it != conditions.end(); ++it) { std::stringstream ss; ss << (*current_target)->GetName(); if ((*current_target)->HasState(it->ID)) { if (IsPositive()) { ss << it->message_recovery; out.push_back(ss.str()); } if (!it->message_already.empty()) { ss << it->message_already; out.push_back(ss.str()); } } else { // Positive case doesn't report anything in case of uselessness if (IsPositive()) { continue; } if ((*current_target)->GetType() == Game_Battler::Type_Ally) { ss << it->message_actor; } else { ss << it->message_enemy; } out.push_back(ss.str()); // Reporting ends with death state if (it->ID == 1) { return; } } } }
void DFO_ExtractSequenceInterval:: CalcOutput(FOcalcType calcType) { DoStatusChk(); if (StatusNotOK()) return; if (!xyOutputData.CreateFrom(xyInputDataDC->xData, xyInputDataDC->yData)) { SetObjErrMsg("memory allocation ??"); return; } SC_DoubleArray& xData = xyOutputData.xData; SC_DoubleArray& yData = xyOutputData.yData; double minTime = sequenceTimesDC->sequenceStartTimes[startSeq]; double maxTime = sequenceTimesDC->sequenceStartTimes[endSeq + 1]; bool pressureFound = false; double startPressure; int nOK = 0; for (int i = 0; i < xyOutputData.Size(); i++) { double currTime = xData[i]; if ((currTime >= minTime) && (currTime <= maxTime)) { double currPress = yData[i]; if (!pressureFound) { startPressure = currPress; pressureFound = true; } if (adjustTimeToStart) currTime = currTime - minTime + startTimeOffsetValue; if (adjustPressureToStart) if (fixedPressureOffset) currPress = currPress - startPressureOffsetValue; else currPress = currPress - startPressure + startPressureOffsetValue; if (absValuePressure) currPress = fabs(currPress); if (log10Pressure) { if (!IsPositive(currPress)) continue; currPress = log10(currPress); } xData[nOK] = currTime; yData[nOK] = currPress; nOK++; } } xyOutputData.SetSize(nOK); // remove duplicates after all other processing if (removeDuplicates && (nOK > 2)) { const double timeEps = 1.0E-07; xyOutputData.RemoveXDuplicates(timeEps); nOK = xyOutputData.Size(); } if (setFinalFlowRate && (nOK > 0)) yData.LastIndex() = finalFlowRate; if (nOK == 0) { SetObjErrMsg("no input data in interval"); return; } xyOutputData.SetID(sequenceTimesDC->sequenceIDs[startSeq]); SetDefaultID(xyOutputData.dataID); }
static bool IsPositive(FloatConstant* value) { return IsPositive(value->Value(), value->GetType()->GetSubtype()); }
//----------------------------------------------------------------------------- // Inline Methods //----------------------------------------------------------------------------- inline bool PolyPlane::InFrontOfPlane( const Vec3& point ) { return IsPositive( SignedDistance(point) ); }
bool Material::IsTransparent () const { return IsPositive (transparency); }
bool Material::IsReflective () const { return IsPositive (reflection); }