精华内容
参与话题
问答
  • Collision

    2017-07-22 12:54:23
    In the second line, output “Collision will not happen.” (without quotes) if the collision will never happen. Otherwise, output two real numbers xc and yc, rounded to one decimal place, which ...
  • Collision

    2016-03-03 09:03:53
    There's a round medal fixed on an ideal smooth table, Fancy is trying to throw some coins and make them slip towards the medal to collide. There's also a round range which shares exact ...

    There's a round medal fixed on an ideal smooth table, Fancy is trying to throw some coins and make them slip towards the medal to collide. There's also a round range which shares exact the same center as the round medal, and radius of the medal is strictly less than radius of the round range. Since that the round medal is fixed and the coin is a piece of solid metal, we can assume that energy of the coin will not lose, the coin will collide and then moving as reflect.

    Now assume that the center of the round medal and the round range is origin ( Namely (0, 0) ) and the coin's initial position is strictly outside the round range. Given radius of the medal Rm, radius of coin r, radius of the round range R, initial position (xy) and initial speed vector (vxvy) of the coin, please calculate the total time that any part of the coin is inside the round range.

    Please note that the coin might not even touch the medal or slip through the round range.

    Input

    There will be several test cases. Each test case contains 7 integers RmRrxyvx and vy in one line. Here 1 ≤ Rm < R ≤ 2000, 1 ≤ r ≤ 1000, R + r < |(xy)| ≤ 20000, 1 ≤ |(vxvy)| ≤ 100.

    Output

    For each test case, please calculate the total time that any part of the coin is inside the round range. Please output the time in one line, an absolute error not more than 1e-3 is acceptable.

    Sample Input

    5 20 1 0 100 0 -1
    5 20 1 30 15 -1 0

    Sample Output

    30.000
    29.394
    题意:光滑的桌面上放两个同心圆,一枚硬币以一定速度行驶,碰到小圆会反弹,求硬币部分在圆环中所花的总时间
    #include<iostream>
    #include<cstdio>
    #include<cmath>
    using namespace std;
    
    int main()
    {
    	double Rm,R,r,x,y,vx,vy;
    	while(scanf("%lf%lf%lf%lf%lf%lf%lf",&Rm,&R,&r,&x,&y,&vx,&vy)!=EOF)
    	{
    		double ans=0;
    		Rm+=r; R+=r;
    		double A=vx*vx+vy*vy;
    		double B=2*x*vx+2*y*vy;
    		double C1=x*x+y*y-R*R;
    		double C2=x*x+y*y-Rm*Rm;
    		double delta1=B*B-4*A*C1;
    		double delta2=B*B-4*A*C2;
    		if(delta1>0&&x*vx+y*vy<0)
    		{
    			if(delta2<=0) ans=fabs(sqrt(delta1)/A);
    			else ans=fabs((sqrt(delta1)-sqrt(delta2))/A);
    		}
    		printf("%.3lf\n",ans);
    	}
    	return 0;
    }

    思路:转化成直线与圆的问题

    注意:几何中整形数据可用浮点型输入



    展开全文
  • collision

    2018-03-20 21:06:00
    提示md5哈希碰撞(并没有用) 照旧ssh ls -al 和上一关差不多,一个可执行文件,一个源码,一个无法读取的flag文件 查看源码 #include <stdio.h> #include <...unsigned long che...

    提示md5哈希碰撞(并没有用)

    照旧ssh ls -al

    和上一关差不多,一个可执行文件,一个源码,一个无法读取的flag文件

    查看源码

      
    #include <stdio.h>
    #include <string.h>
    unsigned long hashcode = 0x21DD09EC;
    //转换并相加
    unsigned long check_password(const char* p){
        int* ip = (int*)p;
        int i;
        int res=0;
        for(i=0; i<5; i++){
            res += ip[i];
        }
        return res;
    }
    
    int main(int argc, char* argv[]){
        //至少有一个参数
        if(argc<2){
            printf("usage : %s [passcode]\n", argv[0]);
            return 0;
        }
        //参数长度必须为20
        if(strlen(argv[1]) != 20){
            printf("passcode length should be 20 bytes\n");
            return 0;
        }
    
        if(hashcode == check_password( argv[1] )){
            system("/bin/cat flag");
            return 0;
        }
        else
            printf("wrong passcode.\n");
        return 0;
    }

     

     
     
     

     分析源码:

    将长度为20byte的char型数组转换为int型数组.得到五个整型

    (char型为1Byte,int型为4Byte,而且数据是从右向左存储,所以每四个char转换成一个int)

    最终要求五个整型数字之和等于0x21DD09EC

    解决方法:

     理论上有无数种组合,方便起见这里我们设置四组都是相同的’0x02020202’,最后一组算出来是:

    >>> hex(0x21dd09ec-0x02020202*4)
    '0x19d501e4'

    所以反序输入应该为0xe4 0x01 0xd5 0x19

    由于有非可见字符串,我们无法手动从终端输入,利用python进行输入:

    python -c 'print 4*"\x02\x02\x02\x02"+"\xe4\x01\xd5\x19"' | xargs ./col  

    操作:

     

    flag: daddy! I just managed to create a hash collision

    完毕

    附:

     char型数组转换为int型数组:

    例如我们构造了char型数组abcdefgh,即传入了四个char:0xab、0xcd、0xef、0xgh,转换成int后对应的数值变成0xghefcdab,(小端存储)

    然后一共构造了5组这样的0xghefcdab进行求和最后的结果为0x21DD09EC

     

    python -c (command):

    Execute the Python code in command. command can be one or more statements separated by newlines, with significant leading whitespace as in normal module code.

    If this option is given, the first element of sys.argv will be "-c" and the current directory will be added to the start of sys.path (allowing modules in that directory to be imported as top level modules).

    xargs命令:

    xargs是给命令传递参数的一个过滤器.通常情况下,xargs从管道或者stdin中读取数据.

    xargs的默认命令是echo,这意味着数据将会包含换行和空白,不过通过xargs的处理,换行和空白将被空格取代。

     

    转载于:https://www.cnblogs.com/Archimedes/p/8612659.html

    展开全文
  • Collision clique

    2020-11-29 15:12:37
    <div><p>This remaps the collision clique logic from a previous (and subsequently reverted) PR #2299. Although reverted, many of its changes were eventually rolled into master through other PRs. This ...
  • collision image

    2020-11-21 01:30:20
    We have to determine if two image collide but, using collision on two Actor is easy but we are going crazy in finding the collision only of the drawn part of the image and not the transparency. ...
  • Collision Detection

    2017-11-25 14:02:11
    In physical simulations, video games and computational geometry, collision detection involves algorithms for checking for collision, i.e. intersection, of two given objects. Collision detection ...
  • Collision Detection

    2019-12-28 19:57:34
    In physical simulations, video games and computational geometry, collision detection involves algorithms for checking for collision, i.e. intersection, of two given objects. Collision detection ...
  • Collision comp

    2020-11-27 11:21:18
    <div><p>Pull request for the new collision handling and customizable center of rotation. I am also adding the basic apps I use for testing. Feel free to make more intense apps that have many ...
  • s making the system more flexible when needing to add wrappers on other collision libraries (eg.: FCL, Bullet).</li><li>Started the transition towards having fully functional <strong>collision groups...
  • <div><h2>Collision Filtering <p>During collision detection, pairs of bodies are tested to see if they are in collision. At the limit, there are potentially O(N^2) colliding pairs. In practice, this is...
  • <p>This PR is the first of three for bringing the current system up to spec vis a vis collision filtering; In #4204 it is labeled as "The Plan"'s 2.i. This defers registration of geometry ...
  • Symbol collision

    2020-11-30 10:22:54
    <div><p>There is a collision between https://github.com/rogerclarkmelbourne/Arduino_STM32/blob/4021c32fdb809f16a61c073d04e1d8c2c487a767/STM32F1/system/libmaple/usb/usb_lib/usb_type.h and ...
  • Naming collision

    2020-11-30 11:00:16
    Error: Naming collision detected: /home/cloud/React-native/ReactProject/node_modules/react-native-star-rating/node_modules/react-native/packager/react-packager/src/DependencyResolver/polyfills/...
  • <div><p>The Aabb (axis-aligned bounding box) built by CollisionVisitor currently includes all visible geometry, including shield meshes which extend well beyond the collision mesh. As far as I know, ...
  • Collision filter groups

    2020-11-29 14:46:20
    <div><p>This implements collision filter groups in C++ (see issue #4204). <p>The behavior in C++ resembles that of Matlab but does not reproduce it exactly. <p>1) In C++, a ...
  • Static collision elements

    2020-11-29 01:30:41
    <div><p>It is very useful to know whenever collision objects are static allowing to: 1. Put them in the same collision group/clique so that they are not checked for collisions against each other (#...
  • Collision Ball Game

    2017-08-05 09:22:49
    Collision ball game is one of my favorite game when I was young. I was so fond of this game that I nearly decided to be a physical scientist (But I am not now). Firstly I wanted to construct a problem...
  • collision is weird

    2020-11-29 00:04:59
    And collision between tees are weird. Now we can't finish some maps. Can you use old collision, please? For example: 1. hammerfly is slower 2. "swimming" on tees is like lagging (nut_...
  • Collision model GTests

    2020-11-29 05:53:28
    Even groups seem to be properly setup (Google test for this coming up next) <a href="https://github.com/RobotLocomotion/drake/blob/master/drake/systems/plants/collision/bullet_model.cc#L76">here</a> ...
  • Collision detection

    2020-11-25 03:23:27
    <div><p>Hello, I have a problem with the collision detection with the octomap server. The screenshot best indicates my problem, can anyone tell me what I'm doing wrong? ...
  • Most probable collision

    2020-11-27 05:49:31
    <p>Here is a miniature example of how such a collision works on the internal state, for the real hash algorithm the changes would need to be further apart, but otherwise similar: <pre><code>#include &...
  • <div><p>Without collision avoidance: <img alt="without_collision_avoidance" src="https://img-blog.csdnimg.cn/img_convert/cb1af0203614c3f5be4624a331fe2f87.png" /></p> <p>With collision avoidance: ...
  • Add collision detection

    2020-11-24 18:12:06
    <div><p>Could you possibly add collision detection to Superfish? <p>I've added it in the past but I've recently updated to the latest version and the code has changed so much so I don't ...
  • Add collision policy

    2020-11-24 16:11:43
    <p>Setting the <code>collision_policy: :rebalance</code> for ranked models that usually inserts in the same first/last position will reduce the performance issues in very large ranked lists.</p><p>该...
  • Dynamic collision layer

    2020-11-28 03:03:52
    <div><p>Is there a good way to append chunks of data to the current collision layer on a scene? The main reason is to be able to create dynamic "infinite" games and specially to create the ...
  • <div><p>We have many models with collision meshes like this: <p><img src="http://i.imgur.com/MNrfk.png" /></p> <p>For a small detail like that 1884 triangles in a collision mesh cannot be good for ...
  • In physical simulations, video games and computational geometry, collision detection involves algorithms for checking for collision, i.e. intersection, of two given objects. Collision detection ...
  • In physical simulations, video games and computational geometry, collision detection involves algorithms for checking for collision, i.e. intersection, of two given objects. Collision detection ...
  • Kill rb collision element

    2020-11-28 22:30:03
    a constructor which allowed the collision element's corresponding <code>RigidBody</code> member to be set. <p>Deleting this class merely required extending the <code>Element</code> class to have ...
  • 3D Collision - Ground

    2020-11-29 06:28:02
    options.collision = true; r = RigidBodyManipulator('urdf/simpleTest.urdf',options); x0 = Point(r.getStateFrame); v = r.constructVisualizer; v.display_dt = .05; if (0) sys...

空空如也

1 2 3 4 5 ... 20
收藏数 3,846
精华内容 1,538
关键字:

collision