本文整理汇总了C#中Pattern.addPattern方法的典型用法代码示例。如果您正苦于以下问题:C# Pattern.addPattern方法的具体用法?C# Pattern.addPattern怎么用?C# Pattern.addPattern使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pattern
的用法示例。
在下文中一共展示了Pattern.addPattern方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HexagonTess
/// <summary>
/// Customize this child
/// </summary>
public HexagonTess()
{
InitializeComponent();
double xSmallSegment = 10d;
double xLargeSegment = 20d;
double ySegment = Math.Cos(Math.PI / 6) * 20d;
double height = ySegment * 2;
double width = 40d;
addStartZone(new Point((int)xSmallSegment, 0), new Point((int)(xSmallSegment + xLargeSegment), 0));
setShapeHeight(height);
Pattern pat = new Pattern(60d, height, 0d);
List<DoublePoint> shape1 = new List<DoublePoint>();
List<DoublePoint> shape2 = new List<DoublePoint>();
shape1.Add(new DoublePoint(xSmallSegment + xLargeSegment, 0));
shape1.Add(new DoublePoint(xSmallSegment, 0));
shape1.Add(new DoublePoint(0, ySegment));
shape1.Add(new DoublePoint(xSmallSegment, height));
shape1.Add(new DoublePoint(xSmallSegment + xLargeSegment, height));
shape1.Add(new DoublePoint(width, ySegment));
shape2.Add(new DoublePoint(xLargeSegment + xLargeSegment + xSmallSegment + xSmallSegment, ySegment));
shape2.Add(new DoublePoint(xLargeSegment + xSmallSegment + xSmallSegment, ySegment));
shape2.Add(new DoublePoint(xLargeSegment + xSmallSegment + 0, ySegment + ySegment));
shape2.Add(new DoublePoint(xLargeSegment + xSmallSegment + xSmallSegment, ySegment + height));
shape2.Add(new DoublePoint(xLargeSegment + xSmallSegment + xSmallSegment + xLargeSegment, ySegment + height));
shape2.Add(new DoublePoint(xLargeSegment + xSmallSegment + width, ySegment + ySegment));
pat.addPattern(shape1);
pat.addPattern(shape2);
setPattern(pat);
}
示例2: IsosTri90Tess
/// <summary>
/// Customize this child
/// </summary>
public IsosTri90Tess()
{
InitializeComponent();
double size = 40d;
double temp = Math.Tan(Math.PI / 4d) * (size / 2);
Pattern pat = new Pattern(size, temp * 2d, 0);
List<DoublePoint> tri1 = new List<DoublePoint>();
List<DoublePoint> tri2 = new List<DoublePoint>();
List<DoublePoint> tri3 = new List<DoublePoint>();
List<DoublePoint> tri4 = new List<DoublePoint>();
addStartZone(new Point(0, 0), new Point((int)size, 0));
setShapeHeight(temp);
tri1.Add(new DoublePoint(0, 0));
tri1.Add(new DoublePoint(size / 2, temp));
tri1.Add(new DoublePoint(0, temp*2));
tri2.Add(new DoublePoint(0, 0));
tri2.Add(new DoublePoint(size, 0));
tri2.Add(new DoublePoint(size / 2, temp));
tri3.Add(new DoublePoint(size, temp * 2));
tri3.Add(new DoublePoint(0, temp * 2));
tri3.Add(new DoublePoint(size / 2, temp));
tri4.Add(new DoublePoint(size, temp * 2));
tri4.Add(new DoublePoint(size, 0));
tri4.Add(new DoublePoint(size / 2, temp));
pat.addPattern(tri1);
pat.addPattern(tri2);
pat.addPattern(tri3);
pat.addPattern(tri4);
setPattern(pat);
}
示例3: RectTess
/// <summary>
/// Customize this child
/// </summary>
public RectTess(double ratio)
{
InitializeComponent();
double patBase = 30;
// ratioOver1 is used to scale down the rectangle
double ratioOver1 = ratio - 1;
if (ratioOver1 > 0)
{
// If the ratioOver1 is over 1, the scale down will be much to small, so we will make 1 the max.
if (ratioOver1 > 1d)
ratioOver1 = 1d;
patBase /= ratioOver1 + 1;
}
double heightRatio = ratio;
double patHeight = patBase * heightRatio;
double patWidth = patBase;
addStartZone(new Point(0, 0), new Point((int)patWidth, 0));
setShapeHeight(patHeight);
Pattern pat = new Pattern(patWidth, patHeight, 0d);
List<DoublePoint> tri1 = new List<DoublePoint>();
tri1.Add(new DoublePoint(0, 0));
tri1.Add(new DoublePoint(0, patHeight));
tri1.Add(new DoublePoint(patWidth, patHeight));
tri1.Add(new DoublePoint(patWidth, 0));
pat.addPattern(tri1);
setPattern(pat);
}
示例4: EquilateralTess
/// <summary>
/// Customize this child
/// </summary>
public EquilateralTess()
{
InitializeComponent();
double temp = Math.Tan(Math.PI / 3d) * 20d;
Pattern pat = new Pattern(40, temp, 20);
List<DoublePoint> tri1 = new List<DoublePoint>();
List<DoublePoint> tri2 = new List<DoublePoint>();
addStartZone(new Point(0, 0), new Point(40, 0));
setShapeHeight(temp);
tri1.Add(new DoublePoint(0, 0));
tri1.Add(new DoublePoint(20, temp));
tri1.Add(new DoublePoint(40, 0));
tri2.Add(new DoublePoint(40, 0));
tri2.Add(new DoublePoint(20, temp));
tri2.Add(new DoublePoint(60, temp));
pat.addPattern(tri1);
pat.addPattern(tri2);
setPattern(pat);
}
示例5: KiteTess
/// <summary>
/// Customize this child
/// </summary>
public KiteTess()
{
InitializeComponent();
double heightOnSide = Math.Sin(Math.PI / 3d) * 30d;
double segmentHeight = Math.Tan(Math.PI / 6d) * 30d;
double triH = Math.Sin(Math.PI / 6d) * 30d;
double height = Math.Sqrt(900 + (segmentHeight*segmentHeight));
double totalHeight = height + segmentHeight;
double xFromCenter = Math.Cos(Math.PI / 3d) * 30d;
Pattern pat = new Pattern(60, totalHeight, 30);
List<DoublePoint> tri1 = new List<DoublePoint>();
List<DoublePoint> tri2 = new List<DoublePoint>();
List<DoublePoint> tri3 = new List<DoublePoint>();
List<DoublePoint> tri4 = new List<DoublePoint>();
List<DoublePoint> tri5 = new List<DoublePoint>();
List<DoublePoint> tri6 = new List<DoublePoint>();
addStartZone(new Point(30, 0), new Point(60, 0));
addReflectedStartZone(new Point(0, 0), new Point(30, 0));
setShapeHeight(heightOnSide);
tri1.Add(new DoublePoint(30 - xFromCenter, heightOnSide));
tri1.Add(new DoublePoint(0, segmentHeight));
tri1.Add(new DoublePoint(0, 0));
tri1.Add(new DoublePoint(30, 0));
tri2.Add(new DoublePoint(30 - xFromCenter, heightOnSide));
tri2.Add(new DoublePoint(30, height));
tri2.Add(new DoublePoint(30 + triH, heightOnSide));
tri2.Add(new DoublePoint(30, 0));
tri3.Add(new DoublePoint(60, 0));
tri3.Add(new DoublePoint(60, segmentHeight));
tri3.Add(new DoublePoint(30 + triH, heightOnSide));
tri3.Add(new DoublePoint(30, 0));
tri4.Add(new DoublePoint(60 - xFromCenter, totalHeight - heightOnSide));
tri4.Add(new DoublePoint(30, totalHeight - segmentHeight));
tri4.Add(new DoublePoint(30, totalHeight));
tri4.Add(new DoublePoint(60, totalHeight));
tri5.Add(new DoublePoint(60 - xFromCenter, totalHeight - heightOnSide));
tri5.Add(new DoublePoint(60, totalHeight - height));
tri5.Add(new DoublePoint(60 + triH, totalHeight - heightOnSide));
tri5.Add(new DoublePoint(60, totalHeight));
tri6.Add(new DoublePoint(90, totalHeight));
tri6.Add(new DoublePoint(90, totalHeight - segmentHeight));
tri6.Add(new DoublePoint(60 + triH, totalHeight - heightOnSide));
tri6.Add(new DoublePoint(60, totalHeight));
pat.addPattern(tri1);
pat.addPattern(tri2);
pat.addPattern(tri3);
pat.addPattern(tri4);
pat.addPattern(tri5);
pat.addPattern(tri6);
setPattern(pat);
}
示例6: RhombusTess
/// <summary>
/// Customize this child
/// </summary>
public RhombusTess()
{
InitializeComponent();
double smallSegment = Math.Cos(Math.PI / 3d) * 30d;
double height = Math.Sin(Math.PI / 3d) * 30d;
double lengthLong = Math.Cos(Math.PI / 6d) * 60d;
double lengthShort = Math.Sin(Math.PI / 6d) * 60d;
addStartZone(new Point((int)smallSegment + 30, 0), new Point((int)smallSegment + 60, 0));
addReflectedStartZone(new Point((int)smallSegment, 0), new Point((int)smallSegment + 30, 0));
setShapeHeight(height);
Pattern pat = new Pattern(60d + lengthShort, lengthLong, 0d);
List<DoublePoint> shape1 = new List<DoublePoint>();
List<DoublePoint> shape2 = new List<DoublePoint>();
List<DoublePoint> shape3 = new List<DoublePoint>();
List<DoublePoint> shape4 = new List<DoublePoint>();
List<DoublePoint> shape5 = new List<DoublePoint>();
List<DoublePoint> shape6 = new List<DoublePoint>();
shape1.Add(new DoublePoint(smallSegment, 0));
shape1.Add(new DoublePoint(0, height));
shape1.Add(new DoublePoint(30, height));
shape1.Add(new DoublePoint(30 + smallSegment, 0));
shape2.Add(new DoublePoint(0, height));
shape2.Add(new DoublePoint(smallSegment, lengthLong));
shape2.Add(new DoublePoint(30 + smallSegment, lengthLong));
shape2.Add(new DoublePoint(30, height));
shape3.Add(new DoublePoint(30 + smallSegment, 0));
shape3.Add(new DoublePoint(30, height));
shape3.Add(new DoublePoint(30 + smallSegment, lengthLong));
shape3.Add(new DoublePoint(30 + lengthShort, height));
shape4.Add(new DoublePoint(30 + smallSegment, 0));
shape4.Add(new DoublePoint(30 + lengthShort, height));
shape4.Add(new DoublePoint(60 + lengthShort, height));
shape4.Add(new DoublePoint(60 + smallSegment, 0));
shape5.Add(new DoublePoint(30 + lengthShort, height));
shape5.Add(new DoublePoint(30 + smallSegment, lengthLong));
shape5.Add(new DoublePoint(60 + smallSegment, lengthLong));
shape5.Add(new DoublePoint(60 + lengthShort, height));
shape6.Add(new DoublePoint(60 + lengthShort, height));
shape6.Add(new DoublePoint(60 + smallSegment, lengthLong));
shape6.Add(new DoublePoint(60 + lengthShort, lengthLong * 1.5));
shape6.Add(new DoublePoint(60 + smallSegment + lengthShort, lengthLong));
pat.addPattern(shape1);
pat.addPattern(shape2);
pat.addPattern(shape3);
pat.addPattern(shape4);
pat.addPattern(shape5);
pat.addPattern(shape6);
setPattern(pat);
}
示例7: IsosTri120Tess
/// <summary>
/// Customize this child
/// </summary>
public IsosTri120Tess()
{
InitializeComponent();
double size = 50d;
double temp = Math.Tan(Math.PI / 6d) * (size/2);
double height = temp * 3d;
Pattern pat = new Pattern(size, height, size/2);
List<DoublePoint> tri1 = new List<DoublePoint>();
List<DoublePoint> tri2 = new List<DoublePoint>();
List<DoublePoint> tri3 = new List<DoublePoint>();
List<DoublePoint> tri4 = new List<DoublePoint>();
List<DoublePoint> tri5 = new List<DoublePoint>();
List<DoublePoint> tri6 = new List<DoublePoint>();
addStartZone(new Point(0, 0), new Point((int)size, 0));
setShapeHeight(temp);
tri1.Add(new DoublePoint(0, 0));
tri1.Add(new DoublePoint(size / 2, height));
tri1.Add(new DoublePoint(size / 2, temp));
tri2.Add(new DoublePoint(0, 0));
tri2.Add(new DoublePoint(size, 0));
tri2.Add(new DoublePoint(size / 2, temp));
tri3.Add(new DoublePoint(size / 2, height));
tri3.Add(new DoublePoint(size, 0));
tri3.Add(new DoublePoint(size / 2, temp));
tri4.Add(new DoublePoint(size / 2, height));
tri4.Add(new DoublePoint(size, 0));
tri4.Add(new DoublePoint(size, height - temp));
tri5.Add(new DoublePoint(size / 2, height));
tri5.Add(new DoublePoint(size + (size / 2), height));
tri5.Add(new DoublePoint(size, height - temp));
tri6.Add(new DoublePoint(size + (size / 2), height));
tri6.Add(new DoublePoint(size, 0));
tri6.Add(new DoublePoint(size, height - temp));
pat.addPattern(tri1);
pat.addPattern(tri2);
pat.addPattern(tri3);
pat.addPattern(tri4);
pat.addPattern(tri5);
pat.addPattern(tri6);
setPattern(pat);
}
示例8: Tri3060Tess
/// <summary>
/// Customize the child
/// </summary>
public Tri3060Tess()
{
InitializeComponent();
int baseScale = 30;
double heightOnSide = Math.Sin(Math.PI / 3d) * baseScale;
double segmentHeight = Math.Tan(Math.PI / 6d) * baseScale;
double triH = Math.Sin(Math.PI / 6d) * baseScale;
double height = Math.Sqrt(900 + (segmentHeight * segmentHeight));
double totalHeight = height + segmentHeight;
Pattern pat = new Pattern(baseScale*2, totalHeight, baseScale);
List<DoublePoint> tri1 = new List<DoublePoint>();
List<DoublePoint> tri2 = new List<DoublePoint>();
List<DoublePoint> tri3 = new List<DoublePoint>();
List<DoublePoint> tri4 = new List<DoublePoint>();
List<DoublePoint> tri5 = new List<DoublePoint>();
List<DoublePoint> tri6 = new List<DoublePoint>();
List<DoublePoint> tri7 = new List<DoublePoint>();
List<DoublePoint> tri8 = new List<DoublePoint>();
List<DoublePoint> tri9 = new List<DoublePoint>();
List<DoublePoint> tri10 = new List<DoublePoint>();
List<DoublePoint> tri11 = new List<DoublePoint>();
List<DoublePoint> tri12 = new List<DoublePoint>();
addStartZone(new Point(baseScale, 0), new Point(baseScale * 2, 0));
addReflectedStartZone(new Point(0, 0), new Point(baseScale, 0));
setShapeHeight(heightOnSide);
tri1.Add(new DoublePoint(baseScale, 0));
tri1.Add(new DoublePoint(0, 0));
tri1.Add(new DoublePoint(0, segmentHeight));
tri2.Add(new DoublePoint(baseScale, 0));
tri2.Add(new DoublePoint(0, segmentHeight));
tri2.Add(new DoublePoint(baseScale - triH, heightOnSide));
tri3.Add(new DoublePoint(baseScale, 0));
tri3.Add(new DoublePoint(baseScale, height));
tri3.Add(new DoublePoint(baseScale - triH, heightOnSide));
tri4.Add(new DoublePoint(baseScale, 0));
tri4.Add(new DoublePoint(baseScale, height));
tri4.Add(new DoublePoint(baseScale + triH, heightOnSide));
tri5.Add(new DoublePoint(baseScale, 0));
tri5.Add(new DoublePoint(baseScale + triH, heightOnSide));
tri5.Add(new DoublePoint(baseScale*2, segmentHeight));
tri6.Add(new DoublePoint(baseScale, 0));
tri6.Add(new DoublePoint(baseScale * 2, 0));
tri6.Add(new DoublePoint(baseScale * 2, segmentHeight));
tri7.Add(new DoublePoint(baseScale + baseScale, totalHeight));
tri7.Add(new DoublePoint(baseScale, totalHeight));
tri7.Add(new DoublePoint(baseScale, totalHeight - segmentHeight));
tri8.Add(new DoublePoint(baseScale + baseScale, totalHeight));
tri8.Add(new DoublePoint(baseScale, totalHeight - segmentHeight));
tri8.Add(new DoublePoint(baseScale + baseScale - triH, totalHeight - heightOnSide));
tri9.Add(new DoublePoint(baseScale + baseScale, totalHeight));
tri9.Add(new DoublePoint(baseScale + baseScale, totalHeight - height));
tri9.Add(new DoublePoint(baseScale + baseScale - triH, totalHeight - heightOnSide));
tri10.Add(new DoublePoint(baseScale + baseScale, totalHeight));
tri10.Add(new DoublePoint(baseScale + baseScale, totalHeight - height));
tri10.Add(new DoublePoint(baseScale + baseScale + triH, totalHeight - heightOnSide));
tri11.Add(new DoublePoint(baseScale + baseScale, totalHeight));
tri11.Add(new DoublePoint(baseScale + baseScale + triH, totalHeight - heightOnSide));
tri11.Add(new DoublePoint(baseScale + baseScale * 2, totalHeight - segmentHeight));
tri12.Add(new DoublePoint(baseScale + baseScale, totalHeight));
tri12.Add(new DoublePoint(baseScale + baseScale * 2, totalHeight));
tri12.Add(new DoublePoint(baseScale + baseScale * 2, totalHeight - segmentHeight));
pat.addPattern(tri1);
pat.addPattern(tri2);
pat.addPattern(tri3);
pat.addPattern(tri4);
pat.addPattern(tri5);
pat.addPattern(tri6);
pat.addPattern(tri7);
pat.addPattern(tri8);
pat.addPattern(tri9);
pat.addPattern(tri10);
pat.addPattern(tri11);
pat.addPattern(tri12);
setPattern(pat);
}