I've done my best. The way to continue to compress the code in depth must be very bizarre.
Refer to the following approach based on advanced Mathematica:
list=Table[Manipulate[ with[{[email protected],[email protected]},Graphics[{if[testpoint[p,pt],pink,cyan],[email protected]},Plotrange-3 {{ -1,1},{ -1,1}},ImageSize-{380,415},Plotlabel-Text[Style[If[Testpoint[p,pt],"in which","Out of the box"],FontFamily-"Arial",If[Testpoint[p,pt],Red,Blue], -]]]],{{pts,{{0,0},{X,1/2},{ -1,-1},{2,-3/2},{A},{0,1}}},Sequence@@(3 {{ -1,-1},{ * *}}),Locator,locatorautocreate-{4,infinity}},savedefinitions-True,initialization:> ((*test if Point pt inside Polygon poly*)testpoint[poly_,pt_]:=Round[( Total@Mod[(#-Rotateright[#]) &@ (ArcTan@@ (pt-#) &/@poly),2 Pi,-Pi]/2/Pi)]!=0)],{x,-2,2.55,.1}];Export["Testwinding.gif", List]
Output such a picture in order to look good:
The shortest possible C + + code (shorter than 500 words's baseline The current method is also difficult)
//Note:compile with g++ filename.cpp-std=c++11#include <iostream>#include <cmath>#include <cstdlib>#include <vector>//#include <functional>#define DIM1#define DIM2//#define DM1 (dim1-1)//#define DM2 (dim2-1)//#define _SQ (x) ((x) * (x))/square//#define _CB (x) ABS ((x) * (x) * (x))//absolute value of the cube//#define _CR (x) (unsigned char) (POW ((x), 1.0/3.0))//cube rootunsigned CharGR (int,int);unsigned CharBL (int,int);#define F FloatF e=1.e-7, p=3.14;unsigned CharRD (intIintj) {//YOUR CODE here#define E for (int k=0;k<5;k++) {#define at (x, y) abs (×) >e?x>e?atan (y/x): Y>0?atan (y/x) +p:atan (y/x)-P:Y>0?P/2:-P/2return 255;}BOOLQ (intIintJint* x) {F t[5],o; E T[k]=at ((f) (X[k]-i), (f) (x[k+5]-J)); } F tl=0.; E o=t[(k +1)%5]-T[K]; O+=o<-p?p:o>p?-p:0; Tl+=o; }return ABS(TL) >. 5; };unsigned CharGR (intIintj) {//YOUR CODE here intq[Ten]={ -,135, +,157, $, +,149,Bayi,Bayi,149}, r[Ten]={184, -,183,207,205,168,181,191,161,199}, s[Ten]={183,208,204,185, -, -, A, -, -, the}, t[Ten]={221,259,229,239,252,135,133,157, -,156}, u[Ten]={ -,254,237,231,258, the, the, -, +, the};returnQ (i,j,q) | | Q (i,j,r) | | Q (i,j,s) | | Q (i,j,t) | | Q (i,j,u)?255:0;}unsigned CharBL (intIintj) {//YOUR CODE here return 0;}voidPixel_write (int,int); FILE *FP;intMain () {fp = fopen ("mathpic.ppm","WB");fprintf(FP,"p6\n%d%d\n255\n", DIM1, DIM2); for(intj=0; j<dim2;j++) for(intI=0; i<dim1;i++) Pixel_write (i,j); fclose (FP); system ("Pause");return 0;}voidPixel_write (intIintj) {Static unsigned Charcolor[3];color[0] = RD (i,j) &255; color[1] = GR (i,j) &255; color[2] = BL (i,j) &255; fwrite (color,1,3, FP);}
- Advantages, the code has been further compressed to more than 500 characters, greatly shortened;
- Shortcomings, there is no strict installation of specific places to write code, as well as 140x3 requirements.
The output, though approximate, is also a normal red flag:
C + + red flag in the shortest form: more than 500 characters and can not abide by the original problem rules