当前位置: 首页 > news >正文

网站开发用C网站上面图片上传尺寸

网站开发用C,网站上面图片上传尺寸,电商设计英语,wordpress 调用图片1.判断点是否在一群点内部 要判断一个点是否在一个由多个点围成的多边形内部#xff08;例如一圈点#xff09;#xff0c;可以使用射线法#xff08;Ray Casting Algorithm#xff09;来实现。以下是一个简单的 C# 实现示例 using System;public class Point {public d…1.判断点是否在一群点内部 要判断一个点是否在一个由多个点围成的多边形内部例如一圈点可以使用射线法Ray Casting Algorithm来实现。以下是一个简单的 C# 实现示例 using System;public class Point {public double X { get; set; }public double Y { get; set; }public Point(double x, double y){X x;Y y;} }public class Program {public static bool IsPointInPolygon(Point testPoint, Point[] polygon){bool inside false;int count polygon.Length;for (int i 0, j count - 1; i count; j i){if (((polygon[i].Y testPoint.Y) ! (polygon[j].Y testPoint.Y)) (testPoint.X (polygon[j].X - polygon[i].X) * (testPoint.Y - polygon[i].Y) / (polygon[j].Y - polygon[i].Y) polygon[i].X)){inside !inside;}}return inside;}public static void Main(){Point[] polygon new Point[]{new Point(0, 0),new Point(0, 4),new Point(4, 4),new Point(4, 0)};Point testPoint new Point(2, 2);bool isInside IsPointInPolygon(testPoint, polygon);Console.WriteLine($Point ({testPoint.X}, {testPoint.Y}) is inside the polygon: {isInside});} }2.判断点在直线左侧还是右侧 要在C#中判断一个点在一条直线的左侧还是右侧可以使用点与直线方程的方法。具体来说对于直线上的两个点A和B以及要测试的点P可以通过计算点P相对于直线AB的位置来确定其是否在直线的左侧还是右侧。 以下是一个简单的C#示例 using System;public class Point {public double X { get; set; }public double Y { get; set; }public Point(double x, double y){X x;Y y;} }public class Line {public Point A { get; set; }public Point B { get; set; }public Line(Point a, Point b){A a;B b;}// 计算点P相对于直线AB的位置public double PointRelativeToLine(Point P){return (B.X - A.X) * (P.Y - A.Y) - (B.Y - A.Y) * (P.X - A.X);} }public class Program {public static void Main(){Point pointA new Point(1, 1);Point pointB new Point(4, 5);Line lineAB new Line(pointA, pointB);Point testPoint new Point(2, 3);double position lineAB.PointRelativeToLine(testPoint);if (position 0){Console.WriteLine(Point is on the left side of the line.);}else if (position 0){Console.WriteLine(Point is on the right side of the line.);}else{Console.WriteLine(Point is on the line.);}} } 3.判断两条直线的交点  要判断两条直线的交点可以使用直线的参数方程来求解。两条直线的参数方程可以表示为 直线1 (x x_1 t_1 \cdot (x_2 - x_1)) 和 (y y_1 t_1 \cdot (y_2 - y_1)) 直线2 (x x_3 t_2 \cdot (x_4 - x_3)) 和 (y y_3 t_2 \cdot (y_4 - y_3)) 要求两条直线的交点需要解方程组即求解 (t_1) 和 (t_2)然后代入其中一个直线的参数方程中即可求得交点的坐标。 以下是一个C#示例 using System;public class Point {public double X { get; set; }public double Y { get; set; }public Point(double x, double y){X x;Y y;} }public class Line {public Point A { get; set; }public Point B { get; set; }public Line(Point a, Point b){A a;B b;}// 计算两条直线的交点public Point IntersectionPoint(Line otherLine){double x1 A.X;double y1 A.Y;double x2 B.X;double y2 B.Y;double x3 otherLine.A.X;double y3 otherLine.A.Y;double x4 otherLine.B.X;double y4 otherLine.B.Y;double denominator (x1 - x2) * (y3 - y4) - (y1 - y2) * (x3 - x4);if (denominator 0){throw new InvalidOperationException(Lines are parallel. No intersection point exists.);}double t1 ((x1 - x3) * (y3 - y4) - (y1 - y3) * (x3 - x4)) / denominator;double t2 -((x1 - x2) * (y1 - y3) - (y1 - y2) * (x1 - x3)) / denominator;double intersectionX x1 t1 * (x2 - x1);double intersectionY y1 t1 * (y2 - y1);return new Point(intersectionX, intersectionY);} }public class Program {public static void Main(){Point pointA1 new Point(1, 1);Point pointB1 new Point(4, 5);Line line1 new Line(pointA1, pointB1);Point pointA2 new Point(2, 3);Point pointB2 new Point(6, 1);Line line2 new Line(pointA2, pointB2);try{Point intersectionPoint line1.IntersectionPoint(line2);Console.WriteLine($Intersection Point: ({intersectionPoint.X}, {intersectionPoint.Y}));}catch (InvalidOperationException ex){Console.WriteLine(ex.Message);}} }
http://www.dnsts.com.cn/news/76644.html

相关文章:

  • 网站建设关于公司怎么写百度收录查询
  • qq空间刷赞网站推广上海网站设计优刻
  • 什么是网站的入口制作ppt的软件手机
  • 网站优化专家中学生做的安全作业网站
  • 承接网站建设广告语东莞 企业网站建设
  • 信游天下网站建设梅河口网站建设
  • 江苏工程建设信息官方网站英文网站源码下载
  • 青岛知名网站建设定制在线制作印章软件
  • 网站诊断分析商城网站建设计划书
  • 有没有专门做ppt的网站吗建设安全备案登入那个网站
  • 网站封面制作做静态网站用什么软件
  • 财经类 直播类网站开发网站开发 书籍
  • 高新建设网站电话上海注册公司引流v信xiala5
  • 介绍自己做的网站开发公司 工程管理中存在问题
  • 做app布局参考哪个网站徐州网站设计网
  • html5单页网站模板昆明建网站要多少钱
  • WordPress图片生成文章网站分析与优化
  • qq群推广用什么网站好网页源代码里哪个是视频链接
  • 移商网站建设网站开发售后服务能力
  • 如何做网站预览大连金州旅游景点有哪些
  • 免费的网站域名查询佛山搜索引擎优化
  • 文件外链网站公众号可以做自己网站的超链接
  • 网站建设财务计划与预测金华网站建设哪里好
  • 纯前端网站怎么做rest一个人做网站好难
  • 承德做网站公司中山seo外包
  • 网站建设的征求意见稿教学互动网站开发背景
  • wordpress插件感应侧边栏福州seo网站推广
  • 南京网站设计建设推荐酒店网站建设方案书
  • 学校网站网页建设开题报告书网站技术防护建设
  • 一万并发量的视频网站建设yy直播是干什么的