本文整理汇总了C++中Clip函数的典型用法代码示例。如果您正苦于以下问题:C++ Clip函数的具体用法?C++ Clip怎么用?C++ Clip使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Clip函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
示例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 );
}
}
示例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);
}
示例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;
}
示例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);
}
示例6: Clip
Animation::Animation(Renderer* _owner)
{
owner = _owner;
currentClip = "default";
clip[currentClip] = Clip();
//anim.setTexture(owner->rSource->GetTexture(owner->GetName()));
}
示例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);
}
示例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;
}
示例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;
}
}
示例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;
}
示例11: RectPath
bool Painter::IntersectClipOp(const Rect& r)
{
return true;
RectPath(r);
Clip();
return true;
}
示例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();
}
}
示例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);
}
}
示例14: Begin
bool Painter::ClipOp(const Rect& r)
{
Begin();
RectPath(r);
Clip();
return true;
}
示例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 );
}