这篇教程C++ toFloat函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中toFloat函数的典型用法代码示例。如果您正苦于以下问题:C++ toFloat函数的具体用法?C++ toFloat怎么用?C++ toFloat使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了toFloat函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: vec4FromVariantglm::vec4 vec4FromVariant(const QVariant& object, bool& valid) { glm::vec4 v; valid = false; if (!object.isValid() || object.isNull()) { return v; } else if (object.canConvert<float>()) { v = glm::vec4(object.toFloat()); valid = true; } else if (object.canConvert<QVector4D>()) { auto qvec4 = qvariant_cast<QVector4D>(object); v.x = qvec4.x(); v.y = qvec4.y(); v.z = qvec4.z(); v.w = qvec4.w(); valid = true; } else { auto map = object.toMap(); auto x = map["x"]; auto y = map["y"]; auto z = map["z"]; auto w = map["w"]; if (x.canConvert<float>() && y.canConvert<float>() && z.canConvert<float>() && w.canConvert<float>()) { v.x = x.toFloat(); v.y = y.toFloat(); v.z = z.toFloat(); v.w = w.toFloat(); valid = true; } } return v;}
开发者ID:cozza13,项目名称:hifi,代码行数:31,
示例2: INC_STATSv8::Handle<v8::Value> V8WebKitPoint::constructorCallback(const v8::Arguments& args){ INC_STATS("DOM.WebKitPoint.Constructor"); if (!args.IsConstructCall()) return throwError("DOM object constructor cannot be called as a function.", V8Proxy::TypeError); if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) return args.Holder(); float x = 0; float y = 0; if (args.Length() > 1) { if (!args[0]->IsUndefined()) { x = toFloat(args[0]); if (isnan(x)) x = 0; } if (!args[1]->IsUndefined()) { y = toFloat(args[1]); if (isnan(y)) y = 0; } } RefPtr<WebKitPoint> point = WebKitPoint::create(x, y); V8DOMWrapper::setDOMWrapper(args.Holder(), &info, point.get()); V8DOMWrapper::setJSWrapperForDOMObject(point.release(), v8::Persistent<v8::Object>::New(args.Holder())); return args.Holder();}
开发者ID:Moondee,项目名称:Artemis,代码行数:29,
示例3: INC_STATSv8::Handle<v8::Value> V8CanvasRenderingContext2D::strokeTextCallback(const v8::Arguments& args){ INC_STATS("DOM.CanvasRenderingContext2D.strokeText()"); CanvasRenderingContext2D* context = V8CanvasRenderingContext2D::toNative(args.Holder()); // Two forms: // * strokeText(text, x, y) // * strokeText(text, x, y, maxWidth) if (args.Length() < 3 || args.Length() > 4) { V8Proxy::setDOMException(SYNTAX_ERR); return notHandledByInterceptor(); } String text = toWebCoreString(args[0]); float x = toFloat(args[1]); float y = toFloat(args[2]); if (args.Length() == 4) { float maxWidth = toFloat(args[3]); context->strokeText(text, x, y, maxWidth); } else context->strokeText(text, x, y); return v8::Undefined();}
开发者ID:mikezit,项目名称:Webkit_Code,代码行数:25,
示例4: toFloatbool VRGuiVectorEntry::proxy2D(GdkEventFocus* focus, sigc::slot<void, OSG::Vec2f&> sig, Gtk::Entry* ex, Gtk::Entry* ey) { OSG::Vec2f res; res[0] = toFloat( ex->get_text() ); res[1] = toFloat( ey->get_text() ); sig(res); return true;}
开发者ID:Pfeil,项目名称:polyvr,代码行数:7,
示例5: vec2FromVariantglm::vec2 vec2FromVariant(const QVariant &object, bool& isValid) { isValid = false; glm::vec2 result; if (object.canConvert<float>()) { result = glm::vec2(object.toFloat()); } else if (object.canConvert<QVector2D>()) { auto qvec2 = qvariant_cast<QVector2D>(object); result.x = qvec2.x(); result.y = qvec2.y(); } else { auto map = object.toMap(); auto x = map["x"]; if (!x.isValid()) { x = map["width"]; } auto y = map["y"]; if (!y.isValid()) { y = map["height"]; } if (x.isValid() && y.isValid()) { result.x = x.toFloat(&isValid); if (isValid) { result.y = y.toFloat(&isValid); } } } return result;}
开发者ID:JamesLinus,项目名称:hifi,代码行数:28,
示例6: process_block/* Here is the definition of the block processing function */void process_block(short *clean, short *echo, short *out, int size) { int i; for(i = 0;i < size;i++) { out[i] = toShort(process_sample(toFloat(clean[i]), toFloat(echo[i]))); }}
开发者ID:mewashin,项目名称:SPH,代码行数:8,
示例7: setBrush bool setBrush(const GiContext* ctx) { bool changed = !_ctxused[1]; if (ctx && ctx->hasFillColor()) { if (_gictx.getFillColor() != ctx->getFillColor()) { _gictx.setFillColor(ctx->getFillColor()); changed = true; } } if (!ctx) ctx = &_gictx; if (ctx->hasFillColor() && changed) { _ctxused[1] = true; GiColor color = ctx->getFillColor(); if (gs()) color = gs()->calcPenColor(color); CGContextSetRGBFillColor(getContext(), toFloat(color.r), toFloat(color.g), toFloat(color.b), toFloat(color.a)); } return ctx->hasFillColor(); }
开发者ID:huangzongwu,项目名称:touchvg,代码行数:26,
示例8: toFloatvoid ViFann::runTrain(const qreal *input, qreal *output, const qreal *desiredOutput){ toFloat(input, mInput, mInputCount); toFloat(output, mOutput, mOutputCount); run(mInput, mOutput); toFloat(desiredOutput, mOutput, mOutputCount); train(mInput, mOutput);}
开发者ID:EQ4,项目名称:Visore,代码行数:8,
示例9: parsePointPoint parsePoint(std::string ¢erString) { Point centerPoint; centerString.resize(centerString.length() - 1); size_t leftParen = centerString.find_first_of("("); std::vector<std::string> points = tokenizeString(centerString.substr(leftParen + 1), ","); centerPoint.x = toFloat(points.at(0)); centerPoint.y = toFloat(points.at(1)); return centerPoint;}
开发者ID:loadstar81,项目名称:brainfood,代码行数:9,
示例10: conv_Short2ToByte1 void conv_Short2ToByte1(void* dst, const void* s, s32 numSamples) { LSbyte* d = reinterpret_cast<LSbyte*>(dst); const LSshort* src = reinterpret_cast<const LSshort*>(s); for(s32 i=0; i<numSamples; ++i){ s32 j = i<<1; f32 v = 0.5f*(toFloat(src[j+0]) + toFloat(src[j+1])); d[i] = toByte(v); } }
开发者ID:taqu,项目名称:opus,代码行数:11,
示例11: setPen bool setPen(const GiContext* ctx) { bool changed = !_ctxused[0]; if (ctx && !ctx->isNullLine()) { if (_gictx.getLineColor() != ctx->getLineColor()) { _gictx.setLineColor(ctx->getLineColor()); changed = true; } if (_gictx.getLineWidth() != ctx->getLineWidth()) { _gictx.setLineWidth(ctx->getLineWidth(), ctx->isAutoScale()); changed = true; } if (_gictx.getLineStyle() != ctx->getLineStyle()) { _gictx.setLineStyle(ctx->getLineStyle()); changed = true; } } if (!ctx) ctx = &_gictx; if (!ctx->isNullLine() && changed) { _ctxused[0] = true; GiColor color = ctx->getLineColor(); if (gs()) color = gs()->calcPenColor(color); CGContextSetRGBStrokeColor(getContext(), toFloat(color.r), toFloat(color.g), toFloat(color.b), toFloat(color.a)); float w = ctx->getLineWidth(); w = gs() ? gs()->calcPenWidth(w, ctx->isAutoScale()) : (w < 0 ? -w : 1); CGContextSetLineWidth(getContext(), _fast && w > 1 ? w - 1 : w); // 不是反走样就细一点 int style = ctx->getLineStyle(); CGFloat pattern[6]; if (style >= 0 && style < sizeof(lpats)/sizeof(lpats[0])) { if (lpats[style].arr && !_fast) { // 快速画时不要线型 makeLinePattern(pattern, lpats[style].arr, lpats[style].n, w); CGContextSetLineDash(getContext(), 0, pattern, lpats[style].n); } else { CGContextSetLineDash(getContext(), 0, NULL, 0); } CGContextSetLineCap(getContext(), style > 0 ? kCGLineCapButt : kCGLineCapRound); } } return !ctx->isNullLine(); }
开发者ID:huangzongwu,项目名称:touchvg,代码行数:53,
示例12: conv_Short1ToFloat2 void conv_Short1ToFloat2(void* dst, const void* s, s32 numSamples) { LSfloat* d = reinterpret_cast<LSfloat*>(dst); const LSshort* src = reinterpret_cast<const LSshort*>(s); s32 num = numSamples >> 3; //8 C++ toFrameView函数代码示例 C++ toFile函数代码示例
|