交点算出(2円)
Namespace: FVIL.CaliperAssembly: FVILbasic (in FVILbasic.dll) Version: 3.1.0.0 (3.1.0.17)
Syntax
C# |
---|
public static List<CFviPoint> CrossPoint(
CFviCircle circle1,
CFviCircle circle2
) |
Visual Basic |
---|
Public Shared Function CrossPoint (
circle1 As CFviCircle,
circle2 As CFviCircle
) As List(Of CFviPoint) |
Return Value
Type:
List<(Of <(<'CFviPoint>)>)>
2つの円の交点を求めます。
検出される交点は、0~2 個です。
見つかった交点が List に格納されます。
交点が見つからない時は要素数が 0 個の List を返します。
正常に実行できなかった場合は例外を発行します。
例外の原因と発生位置を特定するには、発行された例外クラスの ErrorCode メンバと Function メンバを参照してください。
エラーコード:
値 | ErrorCode メンバ | 内容 |
---|
51 | FVIL.ErrorCode.LICENSE_ERROR |
ライセンスキーが見つからない為、実行できません。
または、 FVIL._SetUp.InitVisionLibrary が実行されていません。
|
11 | FVIL.ErrorCode.INVALID_PARAMETER | パラメータに誤りがあります。 |
29 | FVIL.ErrorCode.NOT_CALCULABLE | 計算不可能です。 |
1 | FVIL.ErrorCode.FAILED_TO_ALLOCATE | メモリが確保できません。 |
Examples
C# | Copy |
---|
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using fvalgcli;
namespace User.SampleCode
{
public partial class Caliper
{
[FvPluginExecute]
public void CrossPoint_circle_circle()
{
FVIL.Data.CFviCircle circle1 = new FVIL.Data.CFviCircle(140, 140, 80);
FVIL.Data.CFviCircle circle2 = new FVIL.Data.CFviCircle(100, 160, 70);
List<FVIL.Data.CFviPoint> points = FVIL.Caliper.Function.CrossPoint(circle1, circle2);
{
FVIL.Data.CFviImage image = new FVIL.Data.CFviImage(320, 240, FVIL.ImageType.UC8, 1);
FVIL.GDI.CFviDisplay display = new FVIL.GDI.CFviDisplay();
FVIL.GDI.CFviOverlay overlay = new FVIL.GDI.CFviOverlay();
{
FVIL.GDI.CFviGdiCircle gcircle1 = new FVIL.GDI.CFviGdiCircle(circle1);
gcircle1.Pen.Color = Color.Green;
gcircle1.Pen.Width = 1;
gcircle1.Pen.Style = FVIL.GDI.PenStyle.Solid;
FVIL.GDI.CFviGdiCircle gcircle2 = new FVIL.GDI.CFviGdiCircle(circle2);
gcircle2.Pen.Color = Color.Green;
gcircle2.Pen.Width = 1;
gcircle2.Pen.Style = FVIL.GDI.PenStyle.Solid;
System.Collections.Generic.List<FVIL.GDI.CFviGdiPoint> gpoints = new List<FVIL.GDI.CFviGdiPoint>();
for (int index = 0; index < points.Count; index++)
{
gpoints.Add(new FVIL.GDI.CFviGdiPoint(points[index]));
gpoints[index].Pen.Color = Color.Red;
gpoints[index].Pen.Width = 4;
}
overlay.Figures.Add(gcircle1);
overlay.Figures.Add(gcircle2);
foreach (FVIL.GDI.CFviGdiPoint gpoint in gpoints)
{
overlay.Figures.Add(gpoint);
}
overlay.Enable = true;
}
display.Overlays.Add(overlay);
display.Image = image;
display.DisplayRect = image.Window;
FVIL.Data.CFviImage dstimage = new FVIL.Data.CFviImage();
display.SaveImage(dstimage);
FVIL.File.Function.SaveImageFile(Defs.ResultDir + "/Caliper.CrossPoint_circle_circle.png", dstimage);
}
}
}
} |
Visual Basic | Copy |
---|
Imports System.Collections.Generic
Imports System.Text
Imports System.Drawing
Imports fvalgcli
Namespace SampleCode
Public Partial Class Caliper
<FvPluginExecute> _
Public Sub CrossPoint_circle_circle()
Dim circle1 As New FVIL.Data.CFviCircle(140, 140, 80)
Dim circle2 As New FVIL.Data.CFviCircle(100, 160, 70)
Dim points As List(Of FVIL.Data.CFviPoint) = FVIL.Caliper.[Function].CrossPoint(circle1, circle2)
If True Then
Dim image As New FVIL.Data.CFviImage(320, 240, FVIL.ImageType.UC8, 1)
Dim display As New FVIL.GDI.CFviDisplay()
Dim overlay As New FVIL.GDI.CFviOverlay()
If True Then
Dim gcircle1 As New FVIL.GDI.CFviGdiCircle(circle1)
gcircle1.Pen.Color = Color.Green
gcircle1.Pen.Width = 1
gcircle1.Pen.Style = FVIL.GDI.PenStyle.Solid
Dim gcircle2 As New FVIL.GDI.CFviGdiCircle(circle2)
gcircle2.Pen.Color = Color.Green
gcircle2.Pen.Width = 1
gcircle2.Pen.Style = FVIL.GDI.PenStyle.Solid
Dim gpoints As System.Collections.Generic.List(Of FVIL.GDI.CFviGdiPoint) = New List(Of FVIL.GDI.CFviGdiPoint)()
For index As Integer = 0 To points.Count - 1
gpoints.Add(New FVIL.GDI.CFviGdiPoint(points(index)))
gpoints(index).Pen.Color = Color.Red
gpoints(index).Pen.Width = 4
Next
overlay.Figures.Add(gcircle1)
overlay.Figures.Add(gcircle2)
For Each gpoint As FVIL.GDI.CFviGdiPoint In gpoints
overlay.Figures.Add(gpoint)
Next
overlay.Enable = True
End If
display.Overlays.Add(overlay)
display.Image = image
display.DisplayRect = image.Window
Dim dstimage As New FVIL.Data.CFviImage()
display.SaveImage(dstimage)
FVIL.File.[Function].SaveImageFile(Defs.ResultDir & "/Caliper.CrossPoint_circle_circle.png", dstimage)
End If
End Sub
End Class
End Namespace |
Exceptions
See Also