CogLine FitToImage Method Cognex VisionPro 9.10
Adjust the shape's geometric properties such that its default size is based on the image and its SelectedSpaceName. XScale and YScale are multipliers where 1.0 designates 100% scaling.

Namespace: Cognex.VisionPro
Assembly: Cognex.VisionPro.Core (in Cognex.VisionPro.Core.dll) Version: 79.0.0.0
Syntax

public virtual void FitToImage(
	ICogImage image,
	double xScale,
	double yScale
)

Parameters

image
Type: Cognex.VisionPro ICogImage

The image to fit to.

xScale
Type: System Double

The amount to scale by in the x-direction. A value of 1.0 means to scale 100% in the x-direction.

yScale
Type: System Double

The amount to scale by in the x-direction. A value of 1.0 means to scale 100% in the y-direction.

Implements

ICogShape FitToImage(ICogImage, Double, Double)
Exceptions

ExceptionCondition
ArgumentException

image is NULL.

ArgumentException

xScale or yScale is <= 0.0 or > 1.0.

Remarks

Adjusts the shape's geometric properties such that its default size is based on the image and its SelectedSpaceName.

Different shapes behave differently when FitToImage(ICogImage, Double, Double) is called.

Behavior of FitToImage(ICogImage, Double, Double) with different shapesShapeBehavior

CogCircle
CogRectangle
CogRectangleAffine
CogCoordinateAxes

Scales the shape in the x- and y-directions according to the height and width of the image.

CogEllipse

The ellipse is sized to fit just within the image after xScale and yScale have reduced the image size. The principal axes of the ellipse are aligned with the image, not with the selected space name.

CogCircularArc
CogCircularAnnulusSection

The arc or annulus section is centered in the image and sized to fit just within the image after xScale and yScale have reduced the image size. The resulting shape covers the range from 0 to 270 degrees in pixel space. The shape is guaranteed to be circular in the selected space name, but may not be circular in pixel space.

CogEllipticalArc
CogEllipticalAnnulusSection

The arc or annulus section is centered in the image and sized to fit just within the image after xScale and yScalehave reduced the image size. The resulting shape covers the range from 0 to 270 degrees in pixel space. The principal axes of the underlying ellipse are aligned with the image, not with the selected space name.

CogLineSegment

The line segment is centered vertically centered and is horizontal across the image. xScale scales to the width of the image. yScale is ignored.

CogLine

The line's reference point is centered in the bounding rectangle, and its rotation is maintained. xScale and yScale are ignored.

CogPolygon

The centroid of the polygon is centered in the image. xScale and yScale are ignored.

CogPointMarker

The point is centered in the bounding rectangle. xScale and yScale are ignored.

See Also