Simple algorithms and simple logic of small software, how to obtain a technical patent? Complete source code is attached

Source: Internet
Author: User

Source in the last side of the download, is the entry into the year of the project. Though humble, it is an important milestone in my life. Always want to tell the story behind, but the code looks ugly embarrassed to take out.

Seeing the end of the year, the ugly code put out a picture of everyone happy, if someone learned something or be inspired by the story behind, it is a merit.

Description: A large piece (M1-m4 four red marker points), specify the angle of rotation, up to how many black and gray pieces can be cut.

Input: See figure, small piece width high, large width high, angle.

Output: Maximum number of slices.

Technology involves screen coordinates, math and geometry calculations, drawing, multithreading.

The complete project has the serial port control communication and some actual engineering code, and the hardware binds together called the automatic cutting system, successfully applies to the craft invention patent.

The main task is CPU computing, when the computer mainstream is dual-core, so only open two threads, more open useless.

Core algorithm principle:

Translate the blockbuster (in four-point coordinates) along X, y two directions, record the coordinates of each translation and the number of small pieces, and finally take the maximum number of that coordinate, which is the best position.

     Privateboardcut Compute (globalvar param) {//1, calculates the result set of all tangent methods. list<boardcut> Blockbuster list =Coremethod (param); //2, select the result set that can reach the maximum number oflist<boardcut> maxlist = Large list. Where (m = M.smallnum >=param.maxnum).                       ToList (); //3, the maximum number of results to take a randomParam.boardcutlast = Maxlist[maxlist.count/2]; //4. Pan to the right position            float[] Rectanglescope = Core.getrectanglescope (PARAM.BOARDCUTLAST.POINT4);//calculate the range of polygon Pmax            floatDX = --rectanglescope[0]; floatDY = --rectanglescope[2];            Param.boardCutlast.Move (dx, dy); returnParam.boardcutlast; }
View Code
  for(inti = Theadparam.xstart; i < theadparam.xend; i++)            {                //each time the Y-direction loop is completed, return to the Y-start, X plus 1 for the next cycle .Board. P0. X = x1 + i; Board. P1. X = x2 + i; Board. P2. X = x3 + i; Board. P3. X = x4 +i; Board. P0. Y= y1; Board. P1. Y = y2; Board. P2. Y = Y3; Board. P3. Y =Y4;  for(intj =0; J < Gvar.insmallhight +1; J + +) {board. P0. Y= Y1 + j; Board. P1. Y = y2 + j; Board. P2. Y = Y3 + j; Board. P3. Y = Y4 +J; Boardcut Boardcut=Newboardcut (); Boardcut.point4=NewPointf[] {board. P0, board. P1, board. P2, board. P3};//Large coordinatesList<myrectangle> Validrect =NewList<myrectangle>(); //for the entire grid rectangle, such as in large tracts, the number plus 1                    intMun =0; foreach(MyRectangle Rinchgvar.rectangles) {if(core. Rectisinboard (R, Boardcut.point4)) {Mun+=1;                        Validrect.add (R); }} boardcut.smallnum=Mun; Boardcut.smalllist=Validrect;                    Boardcutlist.add (Boardcut); if(Mun >gvar.maxnum) {gvar.maxnum=Mun; }                }            }
View Code

------------------Story Split Line----------------------------------------------------------------------------

Choosing a programmer is a sad story. No education, professional and unpopular, find some formal work everywhere hit the wall. No relatives and friends of the support and communication, desperate to have a virtual out of a "system" and their own dialogue.

The system quietly said to you: you in the Earth ol in the choice of hell difficulty, after countless fight you unexpectedly did not get a diploma. Novice Gift Package did not get, bare run out of the novice village even wood swords are not, the results of wild dogs can not kill. Level 28 still in the naked run, there is no fighting skills, a gold coin has not earned, your life is really a failure ...

I: Better die than live, there is hope alive.

Ding, System hint: you understand "disillusioned, game life", open the god angle of view, activate the talent skill "spirit Victory Law".

Finally, a factory worker like Foxconn is called "Rich Earth Kang". "Fu Tu kang" Implementation of eight late nine, every morning eight o'clock to work, lunch break an hour, nine o'clock in the evening off to dinner. The environment is stuffy, dinner is too late, every noon can see a little sun, with the darkness of the rich Earth Kang is not exaggerated. A maximum of two days a month, the small sickness also have to endure to come on, otherwise deduct the wages another fine. Workers, like machines, require only production and work hours, no extra action or conversation. Often someone fainted and was sent 120, some of whom did not come back. My hourly salary is 5 yuan, the monthly attendance is just 5*10 hours * 30 days = 1500 Yuan.

Do not move, from the difficult to start a low-level apprentice, 28-grade high-school miners at least than those of the 18-level junior high school miners, can always find reasons to comfort themselves.

Ding, the system tip: You use the skills of "working" (note: Get 1500 coins, cooldown time 30 days). You used the Spirit Victory method to restore 5 points of mental value.

Workshop is airtight, overalls are airtight like fire, my job is in the hot stove back and forth goods. And a graduate of the students, most of the major research institutes to do technical backbone. Several in the Chinese Academy of Sciences as a graduate student, there are several stay in school reading Bo, there is a man in the strongest NASA, and I do hard work in the factory. Countless dreams have come back to school to re-study, sometimes in the ruins of the nuclear war on black science and technology, sometimes in the cemetery and the wild Ghosts work together to study the soul, often wake up in the middle of the night to think of an old song "backward will be beaten, never see the Sun."

Ding, System warning: Your mental value is less than 5 points, "spiritual victory Law" can not be used. Learn combat skills as soon as possible, or you will be game over.

Online search found that programmers pay high, fast, no academic requirements. Buy a C + + book now to learn (no money to buy a computer). Evening reading time is not enough, just copy a few pages of code to the workshop secretly see. The workshop is very stuffy, hot stove next to think code is sweating, often want to get God was the leader of the insult, side coworker's expression is this:

Who let me choose the hell difficulty 18 layer of "Made in China" copy, then I sing in the heart "backward will be beaten, never see the Sun." The Wolf left the prairie, easy to disappear in the Wild Dog group, even more than the wild dog died faster.

Ding, System tip: You use the skill "self-motivation" to fill up the mental value (skill description: Sing with Me "If you are happy clap your hands, if you fall behind you will be beaten, if you fall behind you will be beaten Ah").

Ding, System tip: You get the title "Mechanical Maniac", will +5 (title description: As a work machine, but also the delusion of freedom and power, the machine will go insane?) )。

After three months of working in the factory to recruit programmers, I have eliminated the other junior college players by that point C + +. Because the degree is high school only as a temporary worker to take 2000 wages, no one teaches, directly began to do database program. The information department turned out to be 4 people in pb,delphi,c#3 languages, and I joined 5 people in 4 languages. Was later impressed by the VS powerful IDE, and switched to C # development database program, home in the blog park.

Ding, System prompt: Congratulations! You get the skills "write code" and you get the title "Program Ape".

A year later, the software improved the workshop's traditional cutting and typesetting process (which has been used for more than 10 years), saving millions of of the raw material cost per year and applying for patent success. By the high-level "exception" for the formal development staff , enjoy the 4000 monthly salary of undergraduate graduates.

Ding, System tip: You reach the average level of the player before level 30 and get the achievement "catch the Last Bus". Additional tips: If you do not get the achievement you will be a solemn and tragic singing for the rest of your life, you will be happy to get that achievement. "If you're happy, clap your hands and get beaten if you fall behind."

This milestone may be insignificant to others, but it is the key to change the fate for me. In 2015, I looked back and shared this project in hopes of helping some people.

Factories, prisons and XXX are very similar. are hierarchical, strict management. is to take what belongs to you, and then give you to grateful. is to let people eat a full meal and toil, no time to cranky, to achieve stability and harmony.

Maybe the factory owner will not be happy to see it, but then what. Perhaps the body is bound to work and family can not break free, but the heart is freedom.

SOURCE Download: slices of small pieces. rar

Simple algorithms and simple logic of small software, how to obtain a technical patent? Complete source code is attached

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.