Tag: 角度

获得点和原点之间的角度

这可能以前已经回答过,如果有的话,对不起。 我基本上需要从原点到点获得角度。 那么让我们说Origin是(0,0)而我的目标点是(3,0) 。 3点= 90度 6点钟= 180度 9点钟= 270度 12点钟= 0度 不知何故,我必须做一些数学魔术,并发现角度是90度(顶部是0)。 原点可能会有所不同,所以我需要一个带有两个参数的方法,Origin和TargetPoint,它们以度为单位返回双倍角度。 是的,我意识到这看起来简短而且没有建设性,但我让这个问题尽可能简单易懂。 所有其他问题都被关闭了 – .- 谢谢

标准化0到360之间的方向

我正在研究一个简单的旋转程序,它将物体旋转归一化到0到360度之间。 我的C#代码似乎正在运行,但我并不完全满意。 任何人都可以改进下面的代码,使其更健壮吗? public void Rotate(int degrees) { this.orientation += degrees; if (this.orientation < 0) { while (this.orientation = 360) { while (this.orientation >= 360) { this.orientation -= 360; } } }

使用P / Invoke从C#编组“EGLRenderResolutionScaleProperty”到ANGLE

我正在尝试使用P / Invoke让ANGLE在C#中工作。 基本上,我正在创建一个简单的2D表面,然后将其传递给skia(使用SkiaSharp)。 一切都工作,所有这一切,但我有一个问题编组PropertySet到非托管代码。 这个位工作正常: // the properties var props = new PropertySet(); props.Add(“EGLNativeWindowTypeProperty”, swapChainPanel); // the surface attributes int[] surfaceAttrs = { EGL_ANGLE_SURFACE_RENDER_TO_BACK_BUFFER, EGL_TRUE, EGL_NONE }; // create the surface surface = eglCreateWindowSurface(eglDisplay, eglConfig, props, surfaceAttrs); 我的导入如下: [DllImport(“libEGL.dll”)] public static extern IntPtr eglCreateWindowSurface( IntPtr dpy, IntPtr config, [MarshalAs(UnmanagedType.IInspectable)] object win, int[] attrib_list); 当我尝试为高分辨率屏幕设置缩放时,问题就出现了。 […]

C#中的角度测量仪

我想制作一个工具,可以测量表格上两个用户定义的点之间的角度。 我目前没有代码可以执行此操作,因此任何代码都将受到赞赏。 谢谢 UPDATE 它需要是以度为单位,我的点是3个图片盒,每个图片盒的三个点都有不同的颜色供测量角度。 UPDATE 这是我当前的新代码: namespace Angle_Measurer_Tool { public partial class Form1 : Form { public Form1() { InitializeComponent(); } int Dotter = 0; private void button1_Click(object sender, EventArgs e) { Dotter = 1; } public int Distance2D(int x1, int y1, int x2, int y2) { int result = 0; double part1 = […]