本文整理汇总了C++中radius函数的典型用法代码示例。如果您正苦于以下问题:C++ radius函数的具体用法?C++ radius怎么用?C++ radius使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了radius函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: cos
void UBGraphicsProtractor::paintAngleMarker(QPainter *painter)
{
painter->save();
painter->translate(rect().center());
painter->rotate(-mStartAngle);
painter->translate(-rect().center().x(), -rect().center().y());
qreal co = cos(mCurrentAngle * PI/180);
qreal si = sin(mCurrentAngle * PI/180);
qreal rad = radius();
painter->drawLine(QLineF(rect().center(), QPointF(rect().center().x()+ (rad+ 20)*co, rect().center().y() - (rad + 20)*si)));
QPointF center = rect().center();
painter->drawArc(QRectF(center.x() - rad/8, center.y() - rad/8, rad / 4, rad / 4), 0
, (mCurrentAngle - (int)(mCurrentAngle/360)*360)*16);
painter->translate(rect().center());
painter->rotate(-mCurrentAngle);
painter->translate(-rect().center().x(), -rect().center().y());
//Paint Angle text (horizontally)
//restore transformations
painter->translate(rect().center());
painter->rotate(mCurrentAngle);
painter->rotate(mStartAngle);
painter->translate(-rect().center().x(), -rect().center().y());
qreal angle = mCurrentAngle - (int)(mCurrentAngle/360)*360;
if (angle != 0)
{
QString ang = QString("%1°").arg(angle,0, 'f', 1);
QFont font2 = painter->font();
font2.setBold(true);
QFontMetricsF fm2(font2);
painter->setFont(font2);
if (angle < 50)
angle = 90;
else
angle = angle / 2;
co = cos((mStartAngle + angle) * PI/180);
si = sin((mStartAngle + angle) * PI/180);
painter->drawText(QRectF(rect().center().x() + (rad*2.5/10)*co - fm2.width(ang)/2,
rect().center().y() - (rad*2.5/10)*si - fm2.height()/2,
fm2.width(ang), fm2.height()), Qt::AlignTop, ang);
}
painter->restore();
}
开发者ID:OpenEducationFoundation,项目名称:OpenBoard,代码行数:49,代码来源:UBGraphicsProtractor.cpp
示例2: center
void LCVCircle::draw(LcPainter* painter, LcDrawOptions* options, const lc::geo::Area& rect) const {
bool modified = false;
if (this->selected()) {
modified = true;
painter->save();
painter->source_rgba(
options->selectedColor().red(),
options->selectedColor().green(),
options->selectedColor().blue(),
options->selectedColor().alpha()
);
}
if (radius() /** painter->scale() > 5 */) {
painter->circle(center().x(), center().y(), radius());
painter->stroke();
}
if (modified) {
painter->restore();
}
}
开发者ID:bomastudio,项目名称:LibreCAD_3,代码行数:24,代码来源:lcvcircle.cpp
示例3: ice_ring_test
bool ice_ring_test(di::w_spot const& spot,di::SpotFilterAgent* agent){
double r = radius(spot,agent);
for(
af::shared<Distl::icering>::const_iterator ice_ring =
agent->icerings.begin();
ice_ring != agent->icerings.end();
++ice_ring) {
if (
r > agent->pixel_size*(std::sqrt(ice_ring->lowerr2)) - 0.4 &&
r < agent->pixel_size*(std::sqrt(ice_ring->upperr2)) + 0.4
) {return false;}
}
// add a 0.4mm annulus above & below ring to allow for inaccurate center
return true;
}
开发者ID:cctbx,项目名称:cctbx-playground,代码行数:15,代码来源:spotfilter.cpp
示例4: luma
uint8_t ADMVideoMaskedSoften::configure( AVDMGenericVideoStream *instream)
{
_in=instream;
/*uint32_t luma,chroma;
uint32_t radius;
*/
diaElemUInteger luma(&(_param->luma),QT_TR_NOOP("_Luma threshold:"),0,255);
diaElemUInteger chroma(&(_param->chroma),QT_TR_NOOP("C_hroma threshold:"),0,255);
diaElemUInteger radius(&(_param->radius),QT_TR_NOOP("_Radius:"),1,60);
diaElem *elems[3]={&luma,&chroma,&radius};
return diaFactoryRun(QT_TR_NOOP("Soften"),3,elems);
}
开发者ID:BackupTheBerlios,项目名称:avidemux-svn,代码行数:15,代码来源:ADM_vidSoften.cpp
示例5: draw
void Circle::draw(Window const& wndw, Color const& clr)
{
const float pi = std::acos(-1);
float r=radius();
wndw.draw_point(center().x,center().y,clr.r_,clr.g_,clr.b_); //Center+RGB
for (int i=1; i<361; i++)
{
Vec2 start=((make_rotation_mat2(2*pi*i/360))*Vec2(r,0)+center());
Vec2 end=((make_rotation_mat2(2*pi*(i+1)/360))*Vec2(r,0)+center());
wndw.draw_line(start.x,start.y,end.x,end.y,clr.r_,clr.g_,clr.b_);
}
}
开发者ID:PhilJungschlaeger,项目名称:programmiersprachen-aufgabenblatt-2,代码行数:15,代码来源:circle.cpp
示例6: qMin
QRect KisVisualEllipticalSelectorShape::getSpaceForTriangle(QRect geom)
{
int sizeValue = qMin(width(),height());
QRect b(geom.left(), geom.top(), sizeValue, sizeValue);
QLineF radius(b.center(), QPointF(b.left()+m_barWidth, b.center().y()) );
radius.setAngle(90);//point at yellowgreen :)
QPointF t = radius.p2();
radius.setAngle(330);//point to purple :)
QPointF br = radius.p2();
radius.setAngle(210);//point to cerulean :)
QPointF bl = radius.p2();
QPointF tl = QPoint(bl.x(),t.y());
QRect r(tl.toPoint(), br.toPoint());
return r;
}
开发者ID:KDE,项目名称:krita,代码行数:15,代码来源:KisVisualEllipticalSelectorShape.cpp
示例7: radius
void ReactiveRectangleElement::paint(juce::Graphics &g)
{
g.saveState();
if (clip)
{
g.reduceClipRegion(clipPath);
}
if(width() > 0 && height() > 0)
{
if (fill)
{
g.setColour(fillColour());
g.fillRoundedRectangle(fx, fy, fw, fh, radius());
}
g.setColour(borderColour());
g.drawRoundedRectangle(fx, fy, fw, fh, radius(), borderWidth());
}
GraphicsElement::paint(g);
g.restoreState();
}
开发者ID:snanglesvoid,项目名称:SingingFaces,代码行数:24,代码来源:ReactiveRectangleElement.cpp
示例8: calcAtPoint
int JuliaFractal::calcAtPoint(const double x0, const double y0) const
{
long double vectorLength = 0;
auto x = x0;
auto y = y0;
int iteration;
for (iteration = 0;(iteration < maxIterationCount())&(vectorLength < radius()); iteration++ ) {
auto currentX = (x+y)*(x-y) + cPmin;
auto currentY = x*y + x*y + cQmin;
vectorLength = currentX*currentX + currentY*currentY;
x = currentX;
y = currentY;
}
return iteration;
}
开发者ID:SergShtelmakh,项目名称:Fractal-Qt,代码行数:15,代码来源:JuliaFractal.cpp
示例9: center
void CResource::paint() {
float x = center().x();
float y = center().y();
float z = center().z();
float r = radius();
switch(m_type){
case CResource::RES_TYPE_FOOD: glColor3f(0.0, 1.0, 0.0); break;
case CResource::RES_TYPE_WATER: glColor3f(0.0, 0.0, 1.0); break;
default: break;
}
glTranslatef(x, y, z);
glutSolidCube(r);
glTranslatef(-x, -y, -z);
}
开发者ID:andris1986,项目名称:civsim,代码行数:15,代码来源:CResource.cpp
示例10: setup_airspaces
void setup_airspaces(Airspaces& airspaces, const GeoPoint& center, const unsigned n) {
std::ofstream *fin = NULL;
if (verbose) {
Directory::Create(Path(_T("output/results")));
fin = new std::ofstream("output/results/res-bb-in.txt");
}
for (unsigned i=0; i<n; i++) {
AbstractAirspace* as;
if (rand()%4!=0) {
GeoPoint c;
c.longitude = Angle::Degrees(fixed((rand()%1200-600)/1000.0))+center.longitude;
c.latitude = Angle::Degrees(fixed((rand()%1200-600)/1000.0))+center.latitude;
fixed radius(10000.0*(0.2+(rand()%12)/12.0));
as = new AirspaceCircle(c,radius);
} else {
// just for testing, create a random polygon from a convex hull around
// random points
const unsigned num = rand()%10+5;
GeoPoint c;
c.longitude = Angle::Degrees(fixed((rand()%1200-600)/1000.0))+center.longitude;
c.latitude = Angle::Degrees(fixed((rand()%1200-600)/1000.0))+center.latitude;
std::vector<GeoPoint> pts;
for (unsigned j=0; j<num; j++) {
GeoPoint p=c;
p.longitude += Angle::Degrees(fixed((rand()%200)/1000.0));
p.latitude += Angle::Degrees(fixed((rand()%200)/1000.0));
pts.push_back(p);
}
as = new AirspacePolygon(pts,true);
}
airspace_random_properties(*as);
airspaces.Add(as);
if (fin)
*fin << *as;
}
delete fin;
// try inserting nothing
airspaces.Add(NULL);
airspaces.Optimise();
}
开发者ID:kwtskran,项目名称:XCSoar,代码行数:48,代码来源:harness_airspace.cpp
示例11: FCube
std::vector<Cell> MxField::cells() const
{
std::vector<Cell> result;
for (uint32_t x = 0; x < m_sides.x; ++x) {
for (uint32_t y = 0; y < m_sides.y; ++y) {
for (uint32_t z = 0; z < m_sides.z; ++z) {
if (m_field[x][y][z] != 0) {
result.push_back(Cell(//new FCube(side()),
new FSphere(radius()),
dCoord(x * side(), y * side(), z * side())));
}
}
}
}
return result;
}
开发者ID:rue-ryuzaki,项目名称:AeroGen-src,代码行数:16,代码来源:mxfield.cpp
示例12: radius
void Foam::toroidalCS::writeDict(Ostream& os, bool subDict) const
{
if (subDict)
{
os << indent << nl
<< indent << token::BEGIN_BLOCK << incrIndent << nl;
}
coordinateSystem::writeDict(os, false);
os.writeKeyword("radius") << radius() << token::END_STATEMENT << nl;
if (subDict)
{
os << decrIndent << indent << token::END_BLOCK << endl;
}
}
开发者ID:CFMS,项目名称:foam-extend-foam-extend-3.2,代码行数:16,代码来源:toroidalCS.C
示例13: radius
af::shared<int>
di::SpotFilterAgent::resolution_sort(spot_list_t masterlist,
af::shared<int> parentselection){
//First update the w_spot array with calculated resolutions.
for (spot_list_t::iterator spotptr = masterlist.begin();
spotptr != masterlist.end(); ++spotptr) {
double spotradius = radius(*spotptr,this);
double theta = std::atan2(spotradius,distance)/2.0;
spotptr->resolution = wavelength/(2.0 * std::sin(theta));
}
cmp mycmp(masterlist);
//sort according to resolution
af::shared<int> to_be_sorted = parentselection.deep_copy();
std::sort<PtrTyp,cmp>(to_be_sorted.begin(),to_be_sorted.end(),mycmp);
return to_be_sorted;
}
开发者ID:cctbx,项目名称:cctbx-playground,代码行数:16,代码来源:spotfilter.cpp
示例14: center
std::shared_ptr<CAbstractShape> CShapeFactory::CreateEllipse(std::istream & descr)
{
Vec2 center(-1.0, -1.0);
Vec2 radius(-1.0, -1.0);
std::string color;
descr >> color;
descr >> center.x >> center.y >> radius.x >> radius.y;
if (center.x < 0 || center.y < 0 || radius.x < 0 || radius.y < 0)
{
throw std::invalid_argument("Unclear data");
}
auto shape = std::make_shared<CEllipse>(center, radius);
shape->SetColor(GetColor(color));
return shape;
}
开发者ID:Coguar,项目名称:OOD,代码行数:16,代码来源:ShapeFactory.cpp
示例15: param
void blur_channels_node_t::get_expand_radius( int& hradius, int& vradius) const
{
Imath::V2f r_radius = get_value<Imath::V2f>( param( "r_radius"));
Imath::V2f g_radius = get_value<Imath::V2f>( param( "g_radius"));
Imath::V2f b_radius = get_value<Imath::V2f>( param( "b_radius"));
Imath::V2f a_radius = get_value<Imath::V2f>( param( "a_radius"));
r_radius = adjust_blur_size( r_radius, 1);
g_radius = adjust_blur_size( g_radius, 1);
b_radius = adjust_blur_size( b_radius, 1);
a_radius = adjust_blur_size( a_radius, 1);
Imath::V2i radius( round_blur_size( Imath::V2f( std::max( r_radius.x, std::max( g_radius.x, std::max( b_radius.x, a_radius.x))),
std::max( r_radius.y, std::max( g_radius.y, std::max( b_radius.y, a_radius.y))))));
hradius = radius.x;
vradius = radius.y;
}
开发者ID:devernay,项目名称:ramen-1,代码行数:17,代码来源:blur_channels_node.cpp
示例16: center
bool color_picker::mouse_press( const point &p, int b )
{
if ( b == 1 )
{
coord_type r = point::distance( p, center() ) / radius();
if ( r > 0.70 && r < 0.95 )
{
_tracking = true;
point d = p.delta( center() );
coord_type h = std::atan2( d.y(), d.x() );
_current.set_hsl( h, 1.0, 0.5 );
return mouse_move( p );
}
}
return widget::mouse_press( p, b );
}
开发者ID:kdt3rd,项目名称:gecko,代码行数:17,代码来源:color_picker.cpp
示例17: assertWriteEnabled
void
AsdkSmiley::scaleRadius(const double r)
{
assertWriteEnabled();
AcGePoint3d center( center() );
double rad = radius(),
factor = r / rad;
setEyesApart( factor * meyesapart );
setEyesHeight( factor * meyesheight );
setEyeSize( factor * meyesize );
AcGePoint3d left( mouthLeft() ),
bottom( mouthBottom() ),
right( mouthRight() );
setMouth( left.scaleBy( factor, center ), bottom.scaleBy( factor, center ), right.scaleBy( factor, center ) );
setRadius( r );
recordGraphicsModified();
} // smiley radius
开发者ID:kevinzhwl,项目名称:ObjectARXMod,代码行数:17,代码来源:AsdkSmileyNew.cpp
示例18: mc
/***********************************************************************//**
* @brief Return MC sky direction
*
* @param[in] energy Photon energy.
* @param[in] time Photon arrival time.
* @param[in,out] ran Random number generator.
* @return Sky direction.
*
* Draws an arbitrary sky direction from the 2D disk distribution as function
* of the photon @p energy and arrival @p time.
***************************************************************************/
GSkyDir GModelSpatialRadialDisk::mc(const GEnergy& energy,
const GTime& time,
GRan& ran) const
{
// Simulate offset from photon arrival direction
double cosrad = std::cos(radius() * gammalib::deg2rad);
double theta = std::acos(1.0 - ran.uniform() * (1.0 - cosrad)) *
gammalib::rad2deg;
double phi = 360.0 * ran.uniform();
// Rotate sky direction by offset
GSkyDir sky_dir = dir();
sky_dir.rotate_deg(phi, theta);
// Return sky direction
return sky_dir;
}
开发者ID:hsiejkowski,项目名称:gammalib,代码行数:28,代码来源:GModelSpatialRadialDisk.cpp
示例19: findPoly
vector<Point> findPoly(int vertices, vector<Point> points) {
double angle = (2 * M_PI) / ((double)vertices);
double dist = radius(points);
Point center = polyCenter(points);
Point offset = center + Point(0, 2 * dist);
vector<Point> result;
vector<Point> polygon;
Point first = rotateAround(center, offset, - (0.5 * angle));
polygon.push_back(first);
for (int i = 0; i < vertices - 1; i++) {
Point p = rotateAround(center, first, angle * (i+1));
polygon.push_back(p);
}
return correlate(polygon, points);
}
开发者ID:bus000,项目名称:scorpion,代码行数:18,代码来源:poly.cpp
示例20: grid_x
const Options Writer::getDefaultOptions() const
{
Options options;
Option grid_x("grid_dist_x", 6.0, "X grid distance");
Option grid_y("grid_dist_y", 6.0, "Y grid distance");
double default_radius = (double) sqrt(2.0) * grid_x.getValue<double>();
Option radius("radius", default_radius);
Option fill_window_size("fill_window_size", 3);
options.add(grid_x);
options.add(grid_y);
options.add(radius);
options.add(fill_window_size);
return options;
}
开发者ID:xhy20070406,项目名称:PDAL,代码行数:18,代码来源:Writer.cpp
注:本文中的radius函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论