📄 initfigure.c
字号:
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// INTEL CORPORATION PROPRIETARY INFORMATION
// This software is supplied under the terms of a license agreement or
// nondisclosure agreement with Intel Corporation and may not be copied
// or disclosed except in accordance with the terms of that agreement.
// Copyright (c) 1999 Intel Corporation. All Rights Reserved.
//
// RCS:
// $Source: initFigure.c$
// $Revision: 00.00.05$
// Purpose:
// Contents:
// Authors:
// Sergey Oblomov
//
//M*/
#include "ats.h"
/*F///////////////////////////////////////////////////////////////////////////////////////
// Name: atsbInitEllipse
// Purpose: filling the source 2D array by constant value
// Context:
// Parameters:
// Src - source array
// width - width of source array
// height - height of source array
// step - width step
// x, y - center of ellipse
// major - major axis of ellipse
// minor - minor axis of ellipse
// orientation - orientation of ellipse
// value - the constant value which will be set within elipse
// Returns:
// Notes:
// orientation is the angle from horisontal clockwise
//F*/
void atsbInitEllipse( uchar* Src,
int width,
int height,
int step,
int x,
int y,
int major,
int minor,
float orientation,
uchar value )
{
/* Some variables */
int i, j;
float cx, cy;
/* Filling */
for( i = 0; i < height; i++ )
{
for( j = 0; j < width; j++ )
{
cx = (float)((j - x) * cos( orientation ) + (i - y) * sin( orientation ));
cy = (float)(-(j - x) * sin( orientation ) + (i - y) * cos( orientation ));
if( (cx * cx) / (major * major) + (cy * cy) / (minor * minor) <= 1.0f )
Src[j] = value;
else Src[j] = 0;
}
Src += step;
}
} /* atsbInitEllipse */
/*F///////////////////////////////////////////////////////////////////////////////////////
// Name: atsfInitEllipse
// Purpose: filling the source 2D array by constant value
// Context:
// Parameters:
// Src - source array
// width - width of source array
// height - height of source array
// step - width step
// x, y - center of ellipse
// major - major axis of ellipse
// minor - minor axis of ellipse
// orientation - orientation of ellipse
// value - the constant value which will be set within elipse
// Returns:
// Notes:
// orientation is the angle from horisontal clockwise
//F*/
void atsfInitEllipse( float* Src,
int width,
int height,
int step,
int x,
int y,
int major,
int minor,
float orientation,
float value )
{
/* Some variables */
int i, j;
float cx, cy;
/* Filling */
for( i = 0; i < height; i++ )
{
for( j = 0; j < width; j++ )
{
cx = (float)((j - x) * cos( orientation ) + (i - y) * sin( orientation ));
cy = (float)(-(j - x) * sin( orientation ) + (i - y) * cos( orientation ));
if( (cx * cx) / (major * major) + (cy * cy) / (minor * minor) <= 1.0f )
Src[j] = value;
else Src[j] = 0;
}
Src = (float*)((long)Src + step);
}
} /* atsfInitEllipse */
/* End of file. */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -