当前位置: 首页>>代码示例>>C#>>正文


C# Geometry.PointD2D类代码示例

本文整理汇总了C#中Altaxo.Geometry.PointD2D的典型用法代码示例。如果您正苦于以下问题:C# PointD2D类的具体用法?C# PointD2D怎么用?C# PointD2D使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PointD2D类属于Altaxo.Geometry命名空间,在下文中一共展示了PointD2D类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Activate

			/// <summary>
			/// Activates this grip, providing the initial position of the mouse.
			/// </summary>
			/// <param name="initialPosition">Initial position of the mouse.</param>
			/// <param name="isActivatedUponCreation">If true the activation is called right after creation of this handle. If false,
			/// thie activation is due to a regular mouse click in this grip.</param>
			public void Activate(PointD2D initialPosition, bool isActivatedUponCreation)
			{
				_wasActivatedUponCreation = isActivatedUponCreation;
				_initialMousePosition = initialPosition;
				_initialObjectPosition = ((GraphicBase)_parent.HittedObject).Position;
				_hasMoved = false;
			}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:13,代码来源:GraphicBase.MovementGripHandle.cs

示例2: EmbeddedImageGraphic

		public EmbeddedImageGraphic(PointD2D graphicPosition, ImageProxy startingImage)
			:
			this()
		{
			this.SetPosition(graphicPosition, Main.EventFiring.Suppressed);
			this.Image = startingImage;
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:7,代码来源:EmbeddedImageGraphic.cs

示例3: Calc_Curve_Bezier_Endpoint

		// see also source of wine at: http://source.winehq.org/source/dlls/gdiplus/graphicspath.c#L445
		// 

		/// <summary>
		/// Calculates Bezier points from cardinal spline endpoints.
		/// </summary>
		/// <param name="end">The end point.</param>
		/// <param name="adj">The adjacent point next to the endpoint.</param>
		/// <param name="tension">The tension.</param>
		/// <returns></returns>
		/// <remarks>Original name in Wine sources: calc_curve_bezier_endp</remarks>
		static PointD2D Calc_Curve_Bezier_Endpoint(PointD2D end, PointD2D adj, double tension)
		{
			// tangent at endpoints is the line from the endpoint to the adjacent point 
			return new PointD2D(
			(tension * (adj.X - end.X) + end.X),
			(tension * (adj.Y - end.Y) + end.Y));
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:18,代码来源:CardinalSplineToBezierSegmentConverter.cs

示例4: OpenCardinalSplineToBezierSegments

		/// <summary>
		/// Converts an open cardinal spline, given by the points in <paramref name="points"/>, to Bezier segments.
		/// </summary>
		/// <param name="points">The control points of the open cardinal spline curve.</param>
		/// <param name="count">Number of control points of the closed cardinal spline curve.</param>
		/// <param name="tension">The tension of the cardinal spline.</param>
		/// <returns>Bezier segments that constitute the closed curve.</returns>
		/// <remarks>Original name in Wine source: GdipAddPathClosedCurve2</remarks>
		public static PointD2D[] OpenCardinalSplineToBezierSegments(PointD2D[] points, int count, double tension)
		{
			const double TENSION_CONST = 0.3;

			int len_pt = count * 3 - 2;
			var pt = new PointD2D[len_pt];
			tension = tension * TENSION_CONST;

			var p1 = Calc_Curve_Bezier_Endpoint(points[0], points[1], tension);
			pt[0] = points[0];
			pt[1] = p1;
			var p2 = p1;

			for (int i = 0; i < count - 2; i++)
			{
				Calc_Curve_Bezier(points, i, tension, out p1, out p2);

				pt[3 * i + 2] = p1;
				pt[3 * i + 3] = points[i + 1];
				pt[3 * i + 4] = p2;
			}

			p1 = Calc_Curve_Bezier_Endpoint(points[count - 1], points[count - 2], tension);

			pt[len_pt - 2] = p1;
			pt[len_pt - 1] = points[count - 1];

			return pt;
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:37,代码来源:CardinalSplineToBezierSegmentConverter.cs

示例5: SquareDistanceLineToPoint

		/// <summary>
		/// Calculates the squared distance between a finite line and a point.
		/// </summary>
		/// <param name="point">The location of the point.</param>
		/// <param name="lineOrg">The location of the line origin.</param>
		/// <param name="lineEnd">The location of the line end.</param>
		/// <returns>The squared distance between the line (threated as having a finite length) and the point.</returns>
		public static double SquareDistanceLineToPoint(PointD2D point, PointD2D lineOrg, PointD2D lineEnd)
		{
			var linex = lineEnd.X - lineOrg.X;
			var liney = lineEnd.Y - lineOrg.Y;
			var pointx = point.X - lineOrg.X;
			var pointy = point.Y - lineOrg.Y;

			var rsquare = linex * linex + liney * liney;
			var xx = linex * pointx + liney * pointy;
			if (xx <= 0) // the point is located before the line, so use
			{         // the distance of the line origin to the point
				return pointx * pointx + pointy * pointy;
			}
			else if (xx >= rsquare) // the point is located after the line, so use
			{                   // the distance of the line end to the point
				pointx = point.X - lineEnd.X;
				pointy = point.Y - lineEnd.Y;
				return pointx * pointx + pointy * pointy;
			}
			else // the point is located in the middle of the line, use the
			{     // distance from the line to the point
				var yy = liney * pointx - linex * pointy;
				return yy * yy / rsquare;
			}
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:32,代码来源:Math2D.cs

示例6: MoveGrip

			public void MoveGrip(PointD2D newPosition)
			{
				newPosition = _parent.Transformation.InverseTransformPoint(newPosition);
				var diff = new PointD2D(newPosition.X - _fixaPosition.X, newPosition.Y - _fixaPosition.Y);
				GraphObject.SetRotationFrom(_fixrPosition, _fixaPosition, _drawrPosition, diff, Main.EventFiring.Suppressed);
				_hasMoved = true;
			}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:7,代码来源:GraphicBase.RotationGripHandle.cs

示例7: OnClick

		/// <summary>
		/// Handles the drawing of a straight single line.
		/// </summary>
		/// <param name="position">Mouse position.</param>
		/// <param name="e">EventArgs.</param>
		/// <returns>The mouse state handler for handling the next mouse events.</returns>
		public override void OnClick(PointD2D position, MouseButtonEventArgs e)
		{
			base.OnClick(position, e);

			if (0 == _currentPoint)
			{
				_cachedActiveLayer = _grac.ActiveLayer;
				_cachedActiveLayerTransformation = _cachedActiveLayer.TransformationFromRootToHere();
				_cachedActiveLayerTransformationGdi = (Matrix)_cachedActiveLayerTransformation;
			}

			// get the page coordinates (in Point (1/72") units)
			var rootLayerCoord = _positionCurrentMouseInRootLayerCoordinates;
			// with knowledge of the current active layer, calculate the layer coordinates from them
			var layerCoord = _cachedActiveLayerTransformation.InverseTransformPoint(rootLayerCoord);

			_Points[_currentPoint].LayerCoordinates = layerCoord;
			_Points[_currentPoint].RootLayerCoordinates = rootLayerCoord;
			_currentPoint++;

			if (2 == _currentPoint)
			{
				FinishDrawing();
				_currentPoint = 0;
				_grac.SetGraphToolFromInternal(NextMouseHandlerType);
			}
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:33,代码来源:SingleLineDrawingMouseHandler.cs

示例8: OnClick

		/// <summary>
		/// Handles the drawing of a straight single line.
		/// </summary>
		/// <param name="position">Mouse position.</param>
		/// <param name="e">EventArgs.</param>
		/// <returns>The mouse state handler for handling the next mouse events.</returns>
		public override void OnClick(PointD2D position, MouseButtonEventArgs e)
		{
			base.OnClick(position, e);

			if (0 == _currentPoint)
			{
				_cachedActiveLayer = _grac.ActiveLayer;
				_cachedActiveLayerTransformation = _cachedActiveLayer.TransformationFromRootToHere();
				_cachedActiveLayerTransformationGdi = (Matrix)_cachedActiveLayerTransformation;
			}

			// get the page coordinates (in Point (1/72") units)
			var rootLayerCoord = _positionCurrentMouseInRootLayerCoordinates;
			// with knowledge of the current active layer, calculate the layer coordinates from them
			var layerCoord = _cachedActiveLayerTransformation.InverseTransformPoint(rootLayerCoord);

			if (e.ChangedButton == MouseButton.Right)
			{
				FinishDrawing();
			}
			else
			{
				_Points.Add(new POINT() { LayerCoordinates = layerCoord, RootLayerCoordinates = rootLayerCoord });
				_currentPoint++;
			}
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:32,代码来源:OpenCardinalSplineMouseHandler.cs

示例9: SetSelectedPivot

		/// <summary>
		/// Sets the selected pivot values for X and Y. Additionally, the reference size is required.
		/// </summary>
		/// <param name="pivotX">The pivot x value.</param>
		/// <param name="pivotY">The pivot y value.</param>
		/// <param name="referenceSize">Size of the reference area.</param>
		public void SetSelectedPivot(RADouble pivotX, RADouble pivotY, PointD2D referenceSize)
		{
			_pivotX = pivotX;
			_pivotY = pivotY;

			_percentLayerXSizeUnit.ReferenceQuantity = new DimensionfulQuantity(referenceSize.X, Units.Length.Point.Instance);
			_percentLayerYSizeUnit.ReferenceQuantity = new DimensionfulQuantity(referenceSize.Y, Units.Length.Point.Instance);
			_xSizeEnvironment = new QuantityWithUnitGuiEnvironment(GuiLengthUnits.Collection, _percentLayerXSizeUnit);
			_ySizeEnvironment = new QuantityWithUnitGuiEnvironment(GuiLengthUnits.Collection, _percentLayerYSizeUnit);

			_guiPivotX.UnitEnvironment = _xSizeEnvironment;
			_guiPivotY.UnitEnvironment = _ySizeEnvironment;
			_guiPivotX.SelectedQuantity = _pivotX.IsAbsolute ? new Units.DimensionfulQuantity(_pivotX.Value, Units.Length.Point.Instance) : new Units.DimensionfulQuantity(_pivotX.Value * 100, _percentLayerXSizeUnit);
			_guiPivotY.SelectedQuantity = _pivotY.IsAbsolute ? new Units.DimensionfulQuantity(_pivotY.Value, Units.Length.Point.Instance) : new Units.DimensionfulQuantity(_pivotY.Value * 100, _percentLayerYSizeUnit);

			if (CanUseRadioGridView())
			{
				SetRadioButton();
				SetUseOfRadioGrid(true);
			}
			else
			{
				SetUseOfRadioGrid(false);
			}
			SetVisibilityOfSwitchButton();
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:32,代码来源:AnchoringControl.xaml.cs

示例10: LinkedImageGraphic

		public LinkedImageGraphic(PointD2D graphicPosition, string ImagePath)
			:
			this()
		{
			this.SetPosition(graphicPosition, Main.EventFiring.Suppressed);
			this.ImagePath = ImagePath;
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:7,代码来源:LinkedImageGraphic.cs

示例11: MoveGrip

			public void MoveGrip(PointD2D newPosition)
			{
				newPosition = _parent.Transformation.InverseTransformPoint(newPosition);
				PointD2D diff = new PointD2D(newPosition.X - _initialMousePosition.X, newPosition.Y - _initialMousePosition.Y);

				GraphObject.SetShearFrom(_fixrPosition, _fixaPosition, _drawrPosition, diff, _initialRotation, _initialShear, _initialScaleX, _initialScaleY, Main.EventFiring.Suppressed);
				_hasMoved = true;
			}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:8,代码来源:GraphicBase.ShearGripHandle.cs

示例12: ShearGripHandle

			public ShearGripHandle(IHitTestObject parent, PointD2D relPos, MatrixD2D spanningHalfYRhombus)
			{
				_parent = parent;
				_drawrPosition = relPos;
				_fixrPosition = new PointD2D(relPos.X == 0 ? 1 : 0, relPos.Y == 0 ? 1 : 0);
				_fixaPosition = GraphObject.RelativeToAbsolutePosition(_fixrPosition, true);
				_spanningHalfYRhombus = spanningHalfYRhombus;
			}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:8,代码来源:GraphicBase.ShearGripHandle.cs

示例13: ResizeGripHandle

			/// <summary>
			/// Initializes a new instance of the <see cref="ResizeGripHandle"/> class.
			/// </summary>
			/// <param name="parent">The data for the object that is about to be resized.</param>
			/// <param name="relPos">The relative position of the handle. A value of 0 designates left (x) or top (y). A value of 1 designates right (x) or bottom (y).</param>
			/// <param name="spanningHalfYRhombus">The spanning half y rhombus.</param>
			public ResizeGripHandle(IHitTestObject parent, PointD2D relPos, MatrixD2D spanningHalfYRhombus)
			{
				_parent = parent;
				_drawrPosition = relPos;
				_fixrPosition = new PointD2D(relPos.X == 0 ? 1 : 0, relPos.Y == 0 ? 1 : 0);
				_fixaPosition = GraphObject.RelativeLocalToAbsoluteParentCoordinates(_fixrPosition);
				_spanningHalfYRhombus = spanningHalfYRhombus;
			}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:14,代码来源:GraphicBase.ResizeGripHandle.cs

示例14: Calc_Curve_Bezier

		/// <summary>
		/// Calculates the control points of the incoming and outgoing Bezier segment around the original point <paramref name="p1"/>.
		/// </summary>
		/// <param name="pts0">The previous point on a cardinal spline curce.</param>
		/// <param name="pts1">The point on a cardinal spline curve for which to calculate the incoming and outgoing Bezier control points.</param>
		/// <param name="pts2">The nex point on the cardinal spline curve.</param>
		/// <param name="tension">The tension of the cardinal spline.</param>
		/// <param name="p1">The Bezier control point that controls the slope towards the point <paramref name="pts1"/>.</param>
		/// <param name="p2">The Bezier control point that controls the slope outwards from the point <paramref name="pts1"/>.</param>
		/// <remarks>This function is not in the original Wine sources. It is introduced here for optimization to avoid allocation of a new array when converting closed cardinal spline curves.</remarks>
		static void Calc_Curve_Bezier(PointD2D pts0, PointD2D pts1, PointD2D pts2, double tension, out PointD2D p1, out PointD2D p2)
		{
			/* calculate tangent */
			var diff = pts2 - pts0;

			/* apply tangent to get control points */
			p1 = pts1 - tension * diff;
			p2 = pts1 + tension * diff;
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:19,代码来源:CardinalSplineToBezierSegmentConverter.cs

示例15: MoveGrip

			public void MoveGrip(PointD2D newPosition)
			{
				newPosition = _parent.Transformation.InverseTransformPoint(newPosition);
				var diff = GraphObject.ToUnrotatedDifference(_fixaPosition, newPosition);
				diff -= _initialMousePosition;

				GraphObject.SetScalesFrom(_fixrPosition, _fixaPosition, _drawrPosition, diff, _initialScaleX, _initialScaleY, Main.EventFiring.Suppressed);
				_hasMoved = true;
			}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:9,代码来源:GraphicBase.RescaleGripHandle.cs


注:本文中的Altaxo.Geometry.PointD2D类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。