反映协调点的代码 [英] code for reflection of coordinating points

查看:73
本文介绍了反映协调点的代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

输入:
将n个协调点作为inut
并根据我们的意愿根据x,y轴反映它们,并计算每个象限中的点数.
样本输入:
输入点数
4
1 1
1 -1
-1 -1
-1 1
输入操作次数
4
x 1 3(根据x轴表示第一,第二,第三点)
数1 3
y 1 2
数1 3
样本输出:
q1 q2 q3 q4
1 1 0 2
0 0 1 3

input:
takes n coordinating points as inut
and reflects them according to x,y axis depending of our wish and counts number of points in each quadrant.
sample input:
enter number of points
4
1 1
1 -1
-1 -1
-1 1
enter number of opperations
4
x 1 3(means reflects first,second,third points according to x-axis)
count 1 3
y 1 2
count 1 3
sample output:
q1 q2 q3 q4
1 1 0 2
0 0 1 3

推荐答案

我认为反射"是指变换图像在镜中被反射的位置.

这很简单.您需要使用沿镜"沿轴之一放置的方式使用坐标系.选择一个坐标变换以这种方式放置您的坐标系.请参阅下面的参考.假设您的镜子沿y轴放置.反射变换就这么简单:

I think by "reflection" you mean transform where the image is reflected like in the mirror.

This is simple. You need to use coordinate system the way that the "mirror" is placed along one of the axes. Choose a coordinate transform to put your coordinate system this way. Please see the reference below. Let''s assume your mirror is placed along the axis y. The reflection transform is then as simple as this:

x -> -x



就这样.

另请参阅: http://en.wikipedia.org/wiki/Coordinate_transformation#Transformations_between_coordinate_systems [



That''s it.

See also: http://en.wikipedia.org/wiki/Coordinate_transformation#Transformations_between_coordinate_systems[^].

—SA


这篇关于反映协调点的代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆