本文整理汇总了C#中Curve类的典型用法代码示例。如果您正苦于以下问题:C# Curve类的具体用法?C# Curve怎么用?C# Curve使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Curve类属于命名空间,在下文中一共展示了Curve类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: MustFlipCurve
/// <summary>
/// Checks if curve is flipped to a plane.
/// </summary>
/// <param name="plane">
/// The plane.
/// </param>
/// <param name="curve">
/// The curve.
/// </param>
/// <returns>
/// True if the curve is flipped to the plane, false otherwise.
/// </returns>
public static bool MustFlipCurve(Plane plane, Curve curve)
{
XYZ xVector = null;
XYZ yVector = null;
if (curve is Arc)
{
Arc arc = curve as Arc;
xVector = arc.XDirection;
yVector = arc.YDirection;
}
else if (curve is Ellipse)
{
Ellipse ellipse = curve as Ellipse;
xVector = ellipse.XDirection;
yVector = ellipse.YDirection;
}
else
return false;
List<double> realListX = ConvertVectorToLocalCoordinates(plane, xVector);
List<double> realListY = ConvertVectorToLocalCoordinates(plane, yVector);
double dot = realListY[0] * (-realListX[1]) + realListY[1] * (realListX[0]);
if (dot < -MathUtil.Eps())
return true;
return false;
}
开发者ID:whztt07,项目名称:BIM-IFC,代码行数:40,代码来源:GeometryUtil.cs
示例2: CreateFCurve
public Curve CreateFCurve()
{
Curve fCurve = new Curve(DefaultValue);
fCurve.AddKeyframe(new Keyframe(1f, 0f));
fCurve.AddKeyframe(new Keyframe(6f, 10f));
return fCurve;
}
开发者ID:AyyTee,项目名称:Aventyr,代码行数:7,代码来源:FCurveTests.cs
示例3: Map
public void Map()
{
// Arrange
var start = new DateTime(2010, 1, 1);
var end = DateUtility.MaxDate;
var range = new DateRange(start, end);
var id = new MDM.Contracts.NexusId { SystemName = "Test", Identifier = "A" };
var contractDetails = new MDM.Contracts.CurveDetails();
var contract = new MDM.Contracts.Curve
{
Identifiers = new MDM.Contracts.NexusIdList { id },
Details = contractDetails,
Nexus = new MDM.Contracts.SystemData { StartDate = start, EndDate = end }
};
// NB Don't assign validity here, want to prove SUT sets it
var details = new Curve();
var mapping = new CurveMapping();
var mappingEngine = new Mock<IMappingEngine>();
mappingEngine.Setup(x => x.Map<MDM.Contracts.NexusId, CurveMapping>(id)).Returns(mapping);
mappingEngine.Setup(x => x.Map<MDM.Contracts.CurveDetails, Curve>(contractDetails)).Returns(details);
var mapper = new CurveMapper(mappingEngine.Object);
// Act
var candidate = mapper.Map(contract);
// Assert
//Assert.AreEqual(1, candidate.Details.Count, "Detail count differs");
Assert.AreEqual(1, candidate.Mappings.Count, "Mapping count differs");
Check(range, details.Validity, "Validity differs");
}
开发者ID:RaoulHolzer,项目名称:EnergyTrading-MDM-Sample,代码行数:35,代码来源:CurveMapperFixture.cs
示例4: AddCurve
public void AddCurve(Curve c)
{
curveList.Add(c);
maxx = 0;
minx = 0;
maxy = 0;
miny = Double.MaxValue;
foreach (Curve cu in curveList)
{
foreach (double a in cu.Data)
{
if (a > maxy)
maxy = a;
if (a < miny)
miny = a;
}
if (cu.Data.Length > maxx)
maxx = cu.Data.Length;
maxy = Math.Ceiling(maxy);
}
foreach (Curve cu in curveList)
{
EnsureCurve(cu);
}
panel1.Invalidate();
}
开发者ID:BietteMaxime,项目名称:black-money-pricer,代码行数:32,代码来源:CurveViewer.cs
示例5: Add
public CurveDetail Add(CurveDetail parent)
{
// there is no hierarchy so parent can be safely ignored
CurveDetail detail = new CurveDetail();
detail.Default(Context.UserName);
Curve curve = new Curve();
curve.Default(Context.UserName);
if (Context.Curves.Local.Count() > 0)
{
curve.CurveID = Context.Curves.Local.Max(x => x.CurveID) + 1;
}
else
{
curve.CurveID = 1;
}
detail.Curve = curve;
detail.CurveID = curve.CurveID;
detail.Name = "Curve Name";
Context.Curves.Add(curve);
Context.CurveDetails.Add(detail);
return detail;
}
开发者ID:Juliusz,项目名称:Test,代码行数:26,代码来源:CurveRepository.cs
示例6: SeaShellEffect
public SeaShellEffect()
{
m_hueSaturationEffect = new HueSaturationEffect() { Saturation = 0.6 -1 };
m_vibranceEffect = new VibranceEffect() { Level = .6 };
m_splitToningEffect = new SplitToneEffect
{
ShadowsHue = 230,
ShadowsSaturation = 37,
HighlightsHue = 50,
HighlightsSaturation = 20
};
var globalCurve = new Curve(CurveInterpolation.Linear, new[]
{
new Point(0, 10),
new Point(32, 68),
new Point(64, 119),
new Point(96, 158),
new Point(128, 187),
new Point(160, 209),
new Point(192, 226),
new Point(255, 248)
});
var curve = new Curve(CurveInterpolation.Linear, new[]
{
new Point(10, 0),
new Point(32, 27),
new Point(70, 70)
});
var redCurve = globalCurve;
var greenCurve = Curve.Compose(curve, globalCurve, null);
var blueCurve = globalCurve;
var curvesEffect = new CurvesEffect(redCurve, greenCurve, blueCurve);
var colorizationLayerList = new LayerList(
new AdjustmentLayer(LayerStyle.Normal(), new GrayscaleEffect()),
new Layer(LayerStyle.Multiply(), context => new ColorImageSource(context.HintedRenderSize, Color.FromArgb(0xff, 0xff, 0xe6, 0x99)))
);
LayerList.AddRange(
new AdjustmentLayer(LayerStyle.Normal(0.2), context => colorizationLayerList.ToImageProvider(context.BackgroundImage, context.HintedRenderSize, context.HintedRenderSize)),
new AdjustmentLayer(LayerStyle.Normal(), new ContrastEffect(-0.15)),
new AdjustmentLayer(LayerStyle.Normal(), curvesEffect),
new AdjustmentLayer(LayerStyle.Normal(), m_hueSaturationEffect),
new AdjustmentLayer(LayerStyle.Normal(), m_vibranceEffect),
new AdjustmentLayer(LayerStyle.Normal(), m_splitToningEffect)
);
Editors.Add(new RangeEditorViewModel<SeaShellEffect>("SaturationLevel", -1.0, 1.0, this, filter => filter.SaturationLevel, (filter, value) => filter.SaturationLevel = value));
// Editors.Add(new RangeEditorViewModel<SeaShellEffect>("ContrastLevel", -1.0, 1.0, this, filter => filter.ContrastLevel, (filter, value) => filter.ContrastLevel = value));
Editors.Add(new RangeEditorViewModel<SeaShellEffect>("VibranceLevel", 0, 1.0, this, filter => filter.VibranceLevel, (filter, value) => filter.VibranceLevel = value));
Editors.Add(new RangeEditorViewModel<SeaShellEffect>("ShadowsHue", 0, 365, this, filter => filter.ShadowsHue, (filter, value) => filter.ShadowsHue = (int)value));
Editors.Add(new RangeEditorViewModel<SeaShellEffect>("ShadowsSaturation", 0, 100, this, filter => filter.ShadowsSaturation, (filter, value) => filter.ShadowsSaturation = (int)value));
Editors.Add(new RangeEditorViewModel<SeaShellEffect>("HighlightsHue", 0, 365, this, filter => filter.HighlightsHue, (filter, value) => filter.HighlightsHue = (int)value));
Editors.Add(new RangeEditorViewModel<SeaShellEffect>("HighlightsSaturation", 0, 100, this, filter => filter.HighlightsSaturation, (filter, value) => filter.HighlightsSaturation = (int)value));
}
开发者ID:modulexcite,项目名称:Lumia-imaging-sdk,代码行数:60,代码来源:SeaShellEffect.cs
示例7: Clamp
public void Clamp()
{
var c = new Curve<float>();
c.DefaultInterpolator = Interpolators<float>.Linear;
c[0] = 1.0f;
c[10] = 2.0f;
c[20] = 3.0f;
c[30] = 4.0f;
c.Clamp(5, 25);
AssertEqualFloat(1.5f, c[0]);
AssertEqualFloat(2.0f, c[10]);
AssertEqualFloat(3.0f, c[20]);
AssertEqualFloat(3.5f, c[30]);
c.Clamp(10, 20);
AssertEqualFloat(2.0f, c[0]);
AssertEqualFloat(2.0f, c[10]);
AssertEqualFloat(3.0f, c[20]);
AssertEqualFloat(3.0f, c[30]);
c.Clamp(15, 15);
AssertEqualFloat(2.5f, c[0]);
AssertEqualFloat(2.5f, c[10]);
AssertEqualFloat(2.5f, c[20]);
AssertEqualFloat(2.5f, c[30]);
}
开发者ID:sq,项目名称:Fracture,代码行数:30,代码来源:CurveTests.cs
示例8: OnDrawGizmosSelected
void OnDrawGizmosSelected()
{
if(start == null || end == null)
{
return;
}
Vector3 s = start.transform.position, e = end.transform.position;
Gizmos.color = new Color(1f, 1f, 1f, 1f);
Gizmos.DrawLine(s, s + a);
Gizmos.DrawLine(e, e + b);
Curve curve = new Curve(s, s + a, e + b, e);
float lenght = curve.lenght;
CurveData ccd = curve.getDataAt(0f);
CurveData ncd;
Gizmos.color = new Color(1f, 0.3f, 0.3f, 1f);
for(int i = 0; i < 20; i++)
{
ncd = curve.getDataAt((i / 20f) * lenght);
Gizmos.DrawLine(ccd.pos, ncd.pos);
ccd = ncd;
}
Gizmos.DrawLine(ccd.pos, e);
}
开发者ID:Snakybo-School,项目名称:OUTGEFOUND,代码行数:29,代码来源:MenuCameraPath.cs
示例9: Create
/// <summary>
/// Creates an <see cref="ITokenSigner"/> instance which saves public keys to the provided <see cref="IPublicKeyDataProvider"/>
/// </summary>
/// <param name="publicKeyDataProvider">The <see cref="IPublicKeyDataProvider"/> for the local service</param>
/// <param name="curve">The curve to use</param>
/// <param name="keyLifetime">The max time a private key and its tokens may be used for</param>
/// <param name="keyRotationPeriod">How often to switch to signing with a new private key. The difference between this and <paramref name="keyLifetime"/> is the maximum token lifetime.</param>
/// <returns>A new <see cref="ITokenSigner"/></returns>
public static ITokenSigner Create(
IPublicKeyDataProvider publicKeyDataProvider,
Curve curve,
TimeSpan keyLifetime,
TimeSpan keyRotationPeriod
) {
CngAlgorithm algorithm;
switch( curve ) {
case Curve.P521: {
algorithm = CngAlgorithm.ECDsaP521;
break;
}
case Curve.P384: {
algorithm = CngAlgorithm.ECDsaP384;
break;
}
case Curve.P256:
default: {
algorithm = CngAlgorithm.ECDsaP256;
break;
}
}
IPrivateKeyProvider privateKeyProvider = EcDsaPrivateKeyProvider
.Factory
.Create(
publicKeyDataProvider,
keyLifetime,
keyRotationPeriod,
algorithm
);
var tokenSigner = new TokenSigner( privateKeyProvider );
return tokenSigner;
}
开发者ID:j3parker,项目名称:D2L.Security.OAuth2,代码行数:43,代码来源:EcDsaTokenSignerFactory.cs
示例10: LoadRgbLookupCurves
private static async Task<Curve[]> LoadRgbLookupCurves(string path, double outputGain, int outputOffset)
{
var storageFile = await Package.Current.InstalledLocation.GetFileAsync(path).AsTask().ConfigureAwait(false);
using (var storageFileImageSource = new StorageFileImageSource(storageFile))
using (var renderer = new BitmapRenderer(storageFileImageSource) { OutputOption = OutputOption.PreserveAspectRatio })
using (var tableBitmap = await renderer.RenderAsync().AsTask().ConfigureAwait(false))
{
var redCurve = new Curve();
var greenCurve = new Curve();
var blueCurve = new Curve();
var redValues = new Point[256];
var greenValues = new Point[256];
var blueValues = new Point[256];
var table = tableBitmap.Buffers[0].Buffer.ToArray();
for (int i = 0; i < 256; ++i)
{
redValues[i] = new Point(i,Math.Min(255, Math.Max(0, (int)(table[i * 4 + 2] * outputGain + outputOffset))));
greenValues[i] = new Point(i,Math.Min(255, Math.Max(0, (int)(table[i * 4 + 1] * outputGain + outputOffset))));
blueValues[i] = new Point(i,Math.Min(255, Math.Max(0, (int)(table[i * 4 + 0] * outputGain + outputOffset))));
}
redCurve.Points = redValues;
greenCurve.Points = greenValues;
blueCurve.Points = blueValues;
return new[] { redCurve, greenCurve, blueCurve };
}
}
开发者ID:modulexcite,项目名称:Lumia-imaging-sdk,代码行数:31,代码来源:LookupCurves.cs
示例11: AddCurves
internal static void AddCurves(ScenarioGeneratorModel context)
{
DateTime now = context.AsOfDate;
var curve1 = new Curve() { StartTime = now.AddDays(-100), EndTime = DateTime.MaxValue, CreatedAt = now, CreatedBy = "A", ApprovedAt = now.AddDays(-100), ApprovedBy = "B", Latest = true };
var curveDetail1 = new CurveDetail() { Name = "SWAPSOIS", StartTime = now.AddDays(-100), EndTime = DateTime.MaxValue, CreatedAt = now, CreatedBy = "A", ApprovedAt = now.AddDays(-100), ApprovedBy = "B", Latest = true };
curve1.CurveDetails.Add(curveDetail1);
var curve2 = new Curve() { StartTime = now.AddDays(-100), EndTime = DateTime.MaxValue, CreatedAt = now, CreatedBy = "A", ApprovedAt = now.AddDays(-100), ApprovedBy = "B", Latest = true };
var curveDetail2 = new CurveDetail() { Name = "SWAPSOISRISK", StartTime = now.AddDays(-100), EndTime = DateTime.MaxValue, CreatedAt = now, CreatedBy = "A", ApprovedAt = now.AddDays(-100), ApprovedBy = "B", Latest = true };
curve2.CurveDetails.Add(curveDetail2);
CurveFamily item = context.CurveFamilies.Where(x => x.Name == "SWAPS").First();
curveDetail1.CurveFamily = item;
curveDetail2.CurveFamily = item;
TargetSystem system = context.TargetSystems.Where(x => x.Name == "Simra").First();
curveDetail1.TargetSystem = system;
curveDetail2.TargetSystem = system;
context.Curves.Add(curve1);
context.Curves.Add(curve2);
context.SaveChanges();
}
开发者ID:Juliusz,项目名称:Test,代码行数:26,代码来源:CurveBS.cs
示例12: LineSource
public LineSource(Curve SrcPath, String Code, int el_m, int SrcID, Phase_Regime ph)
: base(new double[8]{60, 49, 41, 35, 31, 28, 26, 24}, new Point3d(0,0,0), ph, SrcID)
{
string type = SrcPath.GetUserString("SourceType");
string v = SrcPath.GetUserString("Velocity");
double velocity = double.Parse(v);
double delta = double.Parse(SrcPath.GetUserString("delta"));
if (type == "Aircraft (ANCON derived)")
{
D = new ANCON(delta, velocity);
}
else D = new Simple();
samplespermeter = el_m;
Curve = SrcPath;
//Divide curve up in ~equal length segments.
Samples = Curve.DivideEquidistant(1.0 / (double)samplespermeter);
Level = Utilities.PachTools.DecodeSourcePower(Code);
Power = new double[8];
double PowerMod = Curve.GetLength() / (double)Samples.Length;
for (int oct = 0; oct < 8; oct++) Power[oct] = 1E-12 * Math.Pow(10, .1 * Level[oct]) * PowerMod;
}
开发者ID:philrob22,项目名称:PachydermAcoustic_Rhinoceros,代码行数:26,代码来源:LineSources.cs
示例13: StartAndEnd
public void StartAndEnd () {
var c = new Curve<double>();
c[-2] = 1;
c[7] = 2;
Assert.AreEqual(c.Start, -2);
Assert.AreEqual(c.End, 7);
}
开发者ID:mbahar94,项目名称:fracture,代码行数:7,代码来源:CurveTests.cs
示例14: SingleValue
public void SingleValue () {
var c = new Curve<double>();
c[0] = 5.0;
Assert.AreEqual(5.0, c[-1]);
Assert.AreEqual(5.0, c[0]);
Assert.AreEqual(5.0, c[1]);
}
开发者ID:mbahar94,项目名称:fracture,代码行数:7,代码来源:CurveTests.cs
示例15: OldPosterEffect
public OldPosterEffect()
{
// Curves
var globalCurve = new Curve(CurveInterpolation.NaturalCubicSpline)
{
Points = new[]
{
new Point(0, 0),
new Point(38, 17),
new Point(160, 210),
new Point(231, 250),
new Point(255, 255)
}
};
var overlayFactory = new OverlayFactory(
"ms-appx:///images/Filters_Landscape_Overlay_Poster2.png",
"ms-appx:///images/Filters_Portrait_Overlay_Poster2.png",
"ms-appx:///images/Filters_Square_Overlay_Poster2.png");
LayerList = new LayerList(
new AdjustmentLayer(LayerStyle.Normal(), new GrayscaleEffect(0.54, 0.64, 0.0, -0.1)),
new AdjustmentLayer(LayerStyle.Normal(), new CurvesEffect(globalCurve)),
new Layer(LayerStyle.Multiply(), context => new ColorImageSource(context.BackgroundLayer.ImageSize, Color.FromArgb(255, 255, 167, 151))),
new Layer(LayerStyle.Normal(), context => overlayFactory.CreateAsync(context.BackgroundLayer.ImageSize))
);
}
开发者ID:modulexcite,项目名称:Lumia-imaging-sdk,代码行数:27,代码来源:OldPosterEffect.cs
示例16: PopEffect
public PopEffect()
{
var globalCurve = new Curve(CurveInterpolation.NaturalCubicSpline)
{
Points = new[]
{
new Point(0, 0),
new Point(68, 60),
new Point(144, 163),
new Point(255, 255),
}
};
var overlayFactory = new OverlayFactory(
"ms-appx:///images/Filters_Landscape_Overlay_Pop3.png",
"ms-appx:///images/Filters_Portrait_Overlay_Pop3.png",
"ms-appx:///images/Filters_Square_Overlay_Pop3.png");
LayerList = new LayerList()
{
new AdjustmentLayer(LayerStyle.Normal(), new ContrastEffect(1.0)),
new AdjustmentLayer(LayerStyle.Normal(), new CurvesEffect(globalCurve)),
new AdjustmentLayer(LayerStyle.Normal(), new GrayscaleEffect(0.54, 0.64, 0.0, -0.1)),
new AdjustmentLayer(LayerStyle.Normal(), new LevelsEffect(0.7, 0.7 / 2, 0)),
new Layer(LayerStyle.Screen(1.0), context => new ColorImageSource(context.HintedRenderSize, Color.FromArgb(255, 108, 0, 148))),
new Layer(LayerStyle.Lighten(), context => overlayFactory.CreateAsync(context.HintedRenderSize))
};
}
开发者ID:modulexcite,项目名称:Lumia-imaging-sdk,代码行数:28,代码来源:PopEffect.cs
示例17: Transform
/// <summary>
/// Return the transformed curve
/// </summary>
/// <param name="transformation"></param>
/// <returns>the transformed curve</returns>
public ICurve Transform(PlaneTransformation transformation) {
Curve c = new Curve(segs.Count);
foreach (ICurve s in segs)
c.AddSegment(s.Transform(transformation));
return c;
}
开发者ID:danielskowronski,项目名称:network-max-flow-demo,代码行数:12,代码来源:CurveLengthAndParams.cs
示例18: setCurveMethod
protected static void setCurveMethod(Autodesk.Revit.DB.CurveElement ce, Curve c)
{
bool foundMethod = false;
if (hasMethodSetCurve)
{
Type CurveElementType = typeof(Autodesk.Revit.DB.CurveElement);
MethodInfo[] curveElementMethods = CurveElementType.GetMethods(BindingFlags.Instance | BindingFlags.Public);
String nameOfMethodSetCurve = "SetGeometryCurveOverridingJoins";
foreach (MethodInfo m in curveElementMethods)
{
if (m.Name == nameOfMethodSetCurve)
{
object[] argsM = new object[1];
argsM[0] = c;
foundMethod = true;
m.Invoke(ce, argsM);
break;
}
}
}
if (!foundMethod)
{
hasMethodSetCurve = false;
ce.GeometryCurve = c;
}
}
开发者ID:algobasket,项目名称:Dynamo,代码行数:29,代码来源:CurveElement.cs
示例19: GetLowerIndexForPosition
public void GetLowerIndexForPosition () {
var c = new Curve<double>();
c[-1] = 0;
c[-0.5f] = 1;
c[0] = 2;
c[1] = 3;
c[2] = 4;
c[4] = 5;
c[32] = 6;
int i;
i = c.GetLowerIndexForPosition(-2);
Assert.AreEqual(i, 0);
i = c.GetLowerIndexForPosition(-1);
Assert.AreEqual(i, 0);
i = c.GetLowerIndexForPosition(-0.6f);
Assert.AreEqual(i, 0);
i = c.GetLowerIndexForPosition(-0.5f);
Assert.AreEqual(i, 1);
i = c.GetLowerIndexForPosition(0.5f);
Assert.AreEqual(i, 2);
i = c.GetLowerIndexForPosition(5);
Assert.AreEqual(i, 5);
i = c.GetLowerIndexForPosition(36);
Assert.AreEqual(i, 6);
}
开发者ID:mbahar94,项目名称:fracture,代码行数:33,代码来源:CurveTests.cs
示例20: FantasticEffect
public FantasticEffect()
{
var globalCurve = new Curve(CurveInterpolation.NaturalCubicSpline)
{
Points = new[]
{
new Point(0, 0),
new Point(68, 60),
new Point(144, 163),
new Point(255, 255),
}
};
var overlayFactory1 = new OverlayFactory(
"ms-appx:///images/Filters_Landscape_Overlay_Fantastic1.jpg",
"ms-appx:///images/Filters_Portrait_Overlay_Fantastic1.jpg",
"ms-appx:///images/Filters_Square_Overlay_Fantastic1.jpg");
var overlayFactory2 = new OverlayFactory(
"ms-appx:///images/Filters_Landscape_Overlay_Fantastic2.png",
"ms-appx:///images/Filters_Portrait_Overlay_Fantastic2.png",
"ms-appx:///images/Filters_Square_Overlay_Fantastic2.png");
LayerList = new LayerList()
{
new AdjustmentLayer(LayerStyle.Normal(), new ContrastEffect(1.0)),
new AdjustmentLayer(LayerStyle.Normal(), new CurvesEffect(globalCurve)),
new AdjustmentLayer(LayerStyle.Normal(), new GrayscaleEffect(0.54, 0.64, 0.0, -0.1)),
new Layer(LayerStyle.Softlight(), context => overlayFactory1.CreateAsync(context.BackgroundLayer.ImageSize)),
new Layer(LayerStyle.Normal(), context => overlayFactory2.CreateAsync(context.BackgroundLayer.ImageSize))
};
}
开发者ID:modulexcite,项目名称:Lumia-imaging-sdk,代码行数:32,代码来源:FantasticEffect.cs
注:本文中的Curve类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论