• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ Clip函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中Clip函数的典型用法代码示例。如果您正苦于以下问题:C++ Clip函数的具体用法?C++ Clip怎么用?C++ Clip使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了Clip函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: if

void FGSensor::ProcessSensorSignal(void)
{
  Output = Input; // perfect sensor

  // Degrade signal as specified

  if (fail_stuck) {
    Output = PreviousOutput;
  } else if (fcs->GetTrimStatus()) {
    if (lag != 0.0)            {PreviousOutput = Output;    PreviousInput  = Input;}
    if (drift_rate != 0.0)     drift = 0;
    if (gain != 0.0)           Gain();      // models a finite gain
    if (bias != 0.0)           Bias();      // models a finite bias

    if (delay != 0)            for (int i=0; i<delay; i++) output_array[i] = Output;

    Clip();
  } else {
    if (lag != 0.0)            Lag();       // models sensor lag and filter
    if (noise_variance != 0.0) Noise();     // models noise
    if (drift_rate != 0.0)     Drift();     // models drift over time
    if (gain != 0.0)           Gain();      // models a finite gain
    if (bias != 0.0)           Bias();      // models a finite bias

    if (delay != 0)            Delay();     // models system signal transport latencies

    if (fail_low)  Output = -HUGE_VAL;
    if (fail_high) Output =  HUGE_VAL;

    if (bits != 0)             Quantize();  // models quantization degradation

    Clip();
  }
  if (IsOutput) SetOutput();
}
开发者ID:matthewzhenggong,项目名称:jsbsim,代码行数:35,代码来源:FGSensor.cpp


示例2: Clip

void FlatTriangle::Draw( Camera* cam ){
	int i;
	unsigned int* target = cam->target->GetData();
	unsigned int* zbuffer = cam->zbuffer;
	int width = cam->target->GetWidth();
	int height = cam->target->GetHeight();

	Poly p_in, p_out;
	p_in.vertex_count = 3;
	p_in.vertices[0] = vertices[0];
	p_in.vertices[1] = vertices[1];
	p_in.vertices[2] = vertices[2];

	Clip( &p_in, &p_out, &cam->fustrum.sides[0] );
	Clip( &p_out, &p_in, &cam->fustrum.sides[1] );
	Clip( &p_in, &p_out, &cam->fustrum.sides[2] );
	Clip( &p_out, &p_in, &cam->fustrum.sides[3] );

	for(i=0; i<p_in.vertex_count; i++) p_in.vertices[i].point.z += 1.0f;
	Clip( &p_in, &p_out, &cam->fustrum.znear );
	for(i=0; i<p_in.vertex_count; i++) p_in.vertices[i].point.z -= 1.0f;

	Poly* pol = &p_out;
	pol->Triangulate();

	for(i=0; i<pol->face_count; i++){
		vertices2D[0] = cam->TransformVector( pol->vertices[pol->faces[i].a].point );
		vertices2D[1] = cam->TransformVector( pol->vertices[pol->faces[i].b].point );
		vertices2D[2] = cam->TransformVector( pol->vertices[pol->faces[i].c].point );
		DrawFlatTriangle( cam->target, vertices2D, color, zbuffer );
	}
}
开发者ID:imclab,项目名称:cure-for-cancer,代码行数:32,代码来源:renderer.cpp


示例3: GWire2

void GWire2(Vec4 *p, int n, Vec4* colour) {
    int i;
    int x1, y1, x2, y2;
    int reject, col;
    Vec4 value;
    for (i=1;i < n ; i++) {
        x1 = (int) p[i-1][0];
        y1 = (int) p[i-1][1];
        x2 = (int) p[i][0];
        y2 = (int) p[i][1];
        value = colour[i-1];
        col = Colour((int) value[0], (int) value[1], (int) value[2]);
        reject = Clip(0, WIDTH-1, 0, HEIGHT-1, &x1, &y1, &x2, &y2);
        if (!reject)
            Line(x1, y1, x2, y2, col);
    }
    x1 = (int) p[0][0];
    y1 = (int) p[0][1];
    x2 = (int) p[n-1][0];
    y2 = (int) p[n-1][1];
    value = colour[n-1];
    col = Colour((int) value[0], (int) value[1], (int) value[2]);
    reject = Clip(0, WIDTH, 0, HEIGHT, &x1, &y1, &x2, &y2);
    if (!reject)
        Line(x1, y1, x2, y2, col);
}
开发者ID:graingert,项目名称:comp3004-2,代码行数:26,代码来源:polygon.cpp


示例4: destPointClipped

bool LfnTech::Copy(
	void* destBase,
	const void* srcBase,
	const wxRect& destBounds,
	const wxRect& srcBounds,
	const wxPoint& destPoint,
	const wxRect& srcRect,
	int destStride,
	int srcStride,
	int bytesPerPixel)
{
	bool result = false;

	if (!destBounds.IsEmpty() && !srcBounds.IsEmpty())
	{
		wxPoint destPointClipped(destPoint);
		wxPoint srcPointClipped(srcRect.GetPosition());
		wxSize sizeClipped(srcRect.GetSize());

		// Clip against src bounds, then against dest bounds, then once again
		// against src bounds in case the dest clip translation moved it significantly.
		Clip(srcBounds, srcPointClipped, sizeClipped, destPointClipped);
		Clip(destBounds, destPointClipped, sizeClipped, srcPointClipped);
		Clip(srcBounds, srcPointClipped, sizeClipped, destPointClipped);

		result = Copy(destBase, srcBase, destPointClipped, wxRect(srcPointClipped, sizeClipped), destStride, srcStride, bytesPerPixel);
	}

	return result;
}
开发者ID:CUGsongchao,项目名称:lafarren-image-completer,代码行数:30,代码来源:ImageUtils.cpp


示例5: GetHeight

void
Canvas::Copy(int dest_x, int dest_y,
             unsigned dest_width, unsigned dest_height,
             ConstImageBuffer src, int src_x, int src_y)
{
  if (!Clip(dest_x, dest_width, GetWidth(), src_x) ||
      !Clip(dest_y, dest_height, GetHeight(), src_y))
    return;

  SDLRasterCanvas canvas(buffer);
  canvas.CopyRectangle(dest_x, dest_y, dest_width, dest_height,
                       src.At(src_x, src_y), src.pitch);
}
开发者ID:ThomasXBMC,项目名称:XCSoar,代码行数:13,代码来源:Canvas.cpp


示例6: Clip

Animation::Animation(Renderer* _owner)
{
    owner = _owner;
    currentClip = "default";
    clip[currentClip] = Clip();
    //anim.setTexture(owner->rSource->GetTexture(owner->GetName()));
}
开发者ID:stan4cb,项目名称:Distopia---pre.alpha,代码行数:7,代码来源:Animation.cpp


示例7: GetHeight

void
Canvas::StretchTransparentWhite(int dest_x, int dest_y,
                                unsigned dest_width, unsigned dest_height,
                                ConstImageBuffer src, int src_x, int src_y,
                                unsigned src_width, unsigned src_height)
{
  if (!Clip(dest_x, dest_width, GetWidth(), src_x) ||
      !Clip(dest_y, dest_height, GetHeight(), src_y))
    return;

  SDLRasterCanvas canvas(buffer);
  TransparentPixelOperations<ActivePixelTraits> operations(canvas.Import(COLOR_WHITE));
  canvas.ScaleRectangle(dest_x, dest_y, dest_width, dest_height,
                        src.At(src_x, src_y), src.pitch, src.width, src.height,
                        operations);
}
开发者ID:Advi42,项目名称:XCSoar,代码行数:16,代码来源:Canvas.cpp


示例8: Clip

bool FGSensor::Run(void )
{
  Input = InputNodes[0]->getDoubleValue() * InputSigns[0];

  Output = Input; // perfect sensor

  // Degrade signal as specified

  if (fail_stuck) {
    Output = PreviousOutput;
    return true;
  }

  if (lag != 0.0)            Lag();       // models sensor lag and filter
  if (noise_variance != 0.0) Noise();     // models noise
  if (drift_rate != 0.0)     Drift();     // models drift over time
  if (bias != 0.0)           Bias();      // models a finite bias

  if (delay != 0.0)          Delay();     // models system signal transport latencies

  if (fail_low)  Output = -HUGE_VAL;
  if (fail_high) Output =  HUGE_VAL;

  if (bits != 0)             Quantize();  // models quantization degradation

  Clip(); // Is it right to clip a sensor?
  return true;
}
开发者ID:Aero348,项目名称:Matlab-Cularis,代码行数:28,代码来源:FGSensor.cpp


示例9: Clip

bool          Winding::Chop(const vec3_t normal, const vec_t dist)
{
    Winding*      f;
    Winding*      b;

    Clip(normal, dist, &f, &b);
    if (b)
    {
        delete b;
    }

    if (f)
    {
        delete[] m_Points;
        m_NumPoints = f->m_NumPoints;
        m_Points = f->m_Points;
        f->m_Points = NULL;
        delete f;
        return true;
    }
    else
    {
        m_NumPoints = 0;
        delete[] m_Points;
        m_Points = NULL;
        return false;
    }
}
开发者ID:sbenfold,项目名称:zhlt-linux,代码行数:28,代码来源:winding.cpp


示例10: DoClipCallback

int  DoClipCallback(int panel, int control, int event, void *callbackData, int eventData1, int eventData2)
{
    int i;
    double min, max;
    channelPtr chan, newchan;

    if (event == EVENT_COMMIT)
    {
        GetCtrlVal (panel, CLIP_CHANNELS, &i);
        GetCtrlVal (panel, CLIP_MIN, &min);
        GetCtrlVal (panel, CLIP_MAX, &max);

        chan = channellist_GetItem (i);

        newchan = channel_Create();
        if (newchan && channel_AllocMem (newchan, chan->pts) &&
            (Clip (chan->readings, chan->pts, max, min, newchan->readings) == NoErr))
        {
            Fmt (newchan->label, "%s (clipped)", chan->label);
            Fmt (newchan->note, "%s\n%s\nmin = %f[e2p3]\nmax = %f[e2p3]\n",
                 chan->note, newchan->label, min, max);
            channellist_AddChannel (newchan);
            return 1;
        }

        MessagePopup ("Clip Channel Message", "Error clipping channel--function voided");
        if (newchan)
        {
            if (newchan->readings) free (newchan->readings);
            free (newchan);
        }
    }
    return 0;
}
开发者ID:gaorlov,项目名称:DAAS,代码行数:34,代码来源:chanfnc.c


示例11: RectPath

bool Painter::IntersectClipOp(const Rect& r)
{
	return true;
	RectPath(r);
	Clip();
	return true;
}
开发者ID:dreamsxin,项目名称:ultimatepp,代码行数:7,代码来源:Painter.cpp


示例12: Clip

void FGSensor::ProcessSensorSignal(void)
{
    Output = Input; // perfect sensor

    // Degrade signal as specified

    if (fail_stuck) {
        Output = PreviousOutput;
    } else {
        if (lag != 0.0)            Lag();       // models sensor lag and filter
        if (noise_variance != 0.0) Noise();     // models noise
        if (drift_rate != 0.0)     Drift();     // models drift over time
        if (gain != 0.0)           Gain();      // models a finite gain
        if (bias != 0.0)           Bias();      // models a finite bias

        if (delay != 0)            Delay();     // models system signal transport latencies

        if (fail_low)  Output = -HUGE_VAL;
        if (fail_high) Output =  HUGE_VAL;

        if (bits != 0)             Quantize();  // models quantization degradation

        Clip();
    }
}
开发者ID:AEgisTG,项目名称:jsbsim,代码行数:25,代码来源:FGSensor.cpp


示例13: Clip

 _TMESH_TMPL_TYPE
 VOID _TMESH_TMPL_DECL::Clip(iFACET facetIndex, eCOORD coord, REAL minVal, REAL maxVal, REAL step)
 {
   for (REAL val = minVal ;  val <= maxVal; val += step ) {
     Clip(facetIndex, coord, val);
   }
 }
开发者ID:venkat78,项目名称:agrid,代码行数:7,代码来源:geom_ops.cpp


示例14: Begin

bool Painter::ClipOp(const Rect& r)
{
	Begin();
	RectPath(r);
	Clip();
	return true;
}
开发者ID:ultimatepp,项目名称:mirror,代码行数:7,代码来源:DrawOp.cpp


示例15: Clip

//剪切
void Sprite::Clip( Rect& region )
{
    int wid = region._right - region._left + 1;
    int hei = region._bottom - region._top + 1;

    Clip( region._left, region._top, wid, hei );
}
开发者ID:weimingtom,项目名称:easywar,代码行数:8,代码来源:Sprite.cpp


示例16: Clip

bool FGSwitch::Run(void )
{
  bool pass = false;
  double default_output=0.0;

  for (unsigned int i=0; i<tests.size(); i++) {
    if (tests[i]->Default) {
      default_output = tests[i]->GetValue();
    } else {
      pass = tests[i]->condition->Evaluate();
    }

    if (pass) {
      Output = tests[i]->GetValue();
      break;
    }
  }
  
  if (!pass) Output = default_output;

  if (delay != 0) Delay();
  Clip();
  if (IsOutput) SetOutput();

  return true;
}
开发者ID:adrcad,项目名称:jsbsim,代码行数:26,代码来源:FGSwitch.cpp


示例17: source

bool FGWaypoint::Run(void )
{
  double target_latitude = target_latitude_pNode->getDoubleValue() * target_latitude_unit;
  double target_longitude = target_longitude_pNode->getDoubleValue() * target_longitude_unit;
  double source_latitude = source_latitude_pNode->getDoubleValue() * source_latitude_unit;
  double source_longitude = source_longitude_pNode->getDoubleValue() * source_longitude_unit;
  FGLocation source(source_longitude, source_latitude, radius);

  if (WaypointType == eHeading) {     // Calculate Heading
    double heading_to_waypoint_rad = source.GetHeadingTo(target_longitude,
                                                         target_latitude);

    double heading_to_waypoint = 0;
    if (eUnit == eDeg) heading_to_waypoint = heading_to_waypoint_rad * radtodeg;
    else               heading_to_waypoint = heading_to_waypoint_rad;

    Output = heading_to_waypoint;

  } else {                            // Calculate Distance
    double wp_distance = source.GetDistanceTo(target_longitude, target_latitude);

    if (eUnit == eMeters) {
      Output = FeetToMeters(wp_distance);
    } else {
      Output = wp_distance;
    }
  }

  Clip();
  if (IsOutput) SetOutput();

  return true;
}
开发者ID:AEgisTG,项目名称:jsbsim,代码行数:33,代码来源:FGWaypoint.cpp


示例18: Clip

void Polyhedron::Clip(const Plane& plane)
{
    Vector<Vector3> clippedVertices;
    Vector<Vector3> outFace;
    
    Clip(plane, clippedVertices, outFace);
}
开发者ID:valera-rozuvan,项目名称:turso3d,代码行数:7,代码来源:Polyhedron.cpp


示例19: if

bool FGSwitch::Run(void )
{
  bool pass = false;
  double default_output=0.0;

  for (unsigned int i=0; i<tests.size(); i++) {
    if (tests[i]->Logic == eDefault) {
      default_output = tests[i]->GetValue();
    } else if (tests[i]->Logic == eAND) {
      pass = true;
      for (unsigned int j=0; j<tests[i]->conditions.size(); j++) {
        if (!tests[i]->conditions[j]->Evaluate()) pass = false;
      }
    } else if (tests[i]->Logic == eOR) {
      pass = false;
      for (unsigned int j=0; j<tests[i]->conditions.size(); j++) {
        if (tests[i]->conditions[j]->Evaluate()) pass = true;
      }
    } else {
      cerr << "Invalid logic test" << endl;
    }

    if (pass) {
      Output = tests[i]->GetValue();
      break;
    }
  }
  
  if (!pass) Output = default_output;

  Clip();
  if (IsOutput) SetOutput();

  return true;
}
开发者ID:Aero348,项目名称:Matlab-Cularis,代码行数:35,代码来源:FGSwitch.cpp


示例20: GetTileMatrixSizePixel

internals::PointLatLng MercatorProjection::FromPixelToLatLng(const int &x, const int &y, const int &zoom)
{
    internals::PointLatLng ret;// = internals::PointLatLng.Empty;

    Size s = GetTileMatrixSizePixel(zoom);
    double mapSizeX = s.Width();
    double mapSizeY = s.Height();

    double xx = (Clip(x, 0, mapSizeX - 1) / mapSizeX) - 0.5;
    double yy = 0.5 - (Clip(y, 0, mapSizeY - 1) / mapSizeY);

    ret.SetLat(90 - 360 * atan(exp(-yy * 2 * M_PI)) / M_PI);
    ret.SetLng(360 * xx);

    return ret;
}
开发者ID:LeeSaferite,项目名称:OpenPilot,代码行数:16,代码来源:mercatorprojection.cpp



注:本文中的Clip函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ClipCursor函数代码示例发布时间:2022-05-30
下一篇:
C++ ClientUserinfoChanged函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap