# Wedge Fitting (Legacy)

This code snippet shows how to create a wedge measurement tool, adjust the transition parameters, set the nominal gauge position, perform the measurement and retrieve the result using the legacy EasyGauge API.

## C++

```cpp
#include <eVision/EasyGauge/Legacy/EWedgeGauge.h>
```

```cpp
using namespace eVision;
using namespace eVision::Legacy;
// Image constructor
EImageBW8 srcImage;
// EWedgeGauge constructor
Legacy::EWedgeGauge wedgeGauge;
// Adjust the transition parameters
wedgeGauge.SetTransitionType(ETransitionType_Bw);
wedgeGauge.SetTransitionChoice(ETransitionChoice_NthFromBegin);
wedgeGauge.SetTransitionIndex(0);
// Set the wedge fitting gauge position, diameter (50 units),
// breadth (-25 units), starting angle (0) and amplitude (270)
EPoint center(256.f, 256.f);
Legacy::EWedge wedge(center, 50.f, -25.f, 0.f, 270.f);
wedgeGauge.SetWedge(wedge);
// Measure
wedgeGauge.Measure(&srcImage);
// Get the inner and outer radius of the fitted wedge
float innerRadius = wedgeGauge.GetMeasuredWedge().GetInnerRadius();
float outerRadius = wedgeGauge.GetMeasuredWedge().GetOuterRadius();
// Save the point gauge measurement context
wedgeGauge.Save("myWedgeGauge.gge");
```

## C#

```cs
using eVision;
using Legacy = eVision.Legacy;
```

```cs
// Image constructor
EImageBW8 srcImage = new EImageBW8();
// EWedgeGauge constructor
Legacy.EWedgeGauge wedgeGauge = new Legacy.EWedgeGauge();
// Adjust the transition parameters
wedgeGauge.TransitionType = ETransitionType.Bw;
wedgeGauge.TransitionChoice = ETransitionChoice.NthFromBegin;
wedgeGauge.TransitionIndex = 0;
// Set the wedge fitting gauge position, diameter (50 units),
// breadth (-25 units), starting angle (0°) and amplitude (270°)
EPoint center = new EPoint(256.0f, 256.0f);
Legacy.EWedge wedge = new Legacy.EWedge(center, 50.0f, -25.0f, 0.0f, 270.0f);
wedgeGauge.Wedge = wedge;
// Measure
wedgeGauge.Measure(srcImage);
// Get the inner and outer radius of the fitted wedge
float innerRadius = wedgeGauge.MeasuredWedge.InnerRadius;
float outerRadius = wedgeGauge.MeasuredWedge.OuterRadius;
// Save the point gauge measurement context
wedgeGauge.Save("myWedgeGauge.gge");
```

## Python

```py
import eVision
import eVision.Legacy as Legacy
# Image constructor
src_image = eVision.EImageBW8()
# EWedgeGauge constructor
wedge_gauge = Legacy.EWedgeGauge()
# Adjust the transition parameters
wedge_gauge.TransitionType = eVision.ETransitionType.Bw
wedge_gauge.TransitionChoice = eVision.ETransitionChoice.NthFromBegin
wedge_gauge.TransitionIndex = 0
# Set the wedge fitting gauge position, diameter (50 units),
# breadth (-25 units), starting angle (0°) and amplitude (270°)
center = eVision.EPoint(256.0, 256.0)
wedge = eVision.EWedge(center, 50.0, -25.0, 0.0, 270.0)
wedge_gauge.Wedge = wedge
# Measure
wedge_gauge.Measure(src_image)
# Get the inner and outer radius of the fitted wedge
innerRadius = wedge_gauge.MeasuredWedge.InnerRadius
outerRadius = wedge_gauge.MeasuredWedge.OuterRadius
# Save the point gauge measurement context
wedge_gauge.Save("myWedgeGauge.gge")
```
