首页 > 其他分享 >test

test

时间:2023-03-11 17:47:02浏览次数:24  
标签:set pt int hedge2 hedge1 split test

int ite = detail(2, "iteration");
vector norm = v@N;

///// split control
int split = -1;
float rd = rand(@primnum + ite + chf("seed"));
int stopcondition = chi("stopIterConditon");
float splitthreshold = chf("splitthreshold");

if(ite>stopcondition){
    if (rd<splitthreshold ){
        split = 0;
    } else {
        split = 1;
    }
} else {
    split = 1;
}

////Split direction contorl
int npt = nearpoint(1, @P);
vector tangentu = point(1, "tangentu", npt);

vector dir1;
if (ite%2==1){
    dir1 = tangentu;
} else {
    dir1 = cross(tangentu, {0,1,0});
}
vector center = @P;

float minfloat, maxfloat;
minfloat = 999;
maxfloat = -999;
float dotlist[] = array();

int ppts[] = primpoints(0, @primnum);
foreach(int pt; ppts)
{
    vector pos = point(0, "P", pt);
    vector dir = normalize(@P - pos);
    float dot = dot(dir,dir1);

    append(dotlist, dot);
    setpointattrib(0, "dot", pt, dot, "set");
}

int index[] = argsort(dotlist);
ppts = reorder(ppts, index);

int startpt = ppts[0];
int foundpt = ppts[-1];
vector startpos = point(0, "P", startpt);
vector foundpos = point(0, "P", foundpt);
int hedge1 = pointhedge(0, startpt);
int hedge2 = pointhedge(0, foundpt);
int hedge1_orig = hedge1;
int hedge2_orig = hedge2;

int prim1 = addprim(0, "poly");
int prim2 = addprim(0, "poly");
vector color1 = set(1,1,0);
vector color2 = set(0,1,1);
/////First Split
int count1 = 0;

while(hedge2!=hedge1)
{
    if (count1 == 0){
    
        int pt = addpoint(0, foundpos);
        addvertex(0, prim1, pt);
        setpointattrib(0, "Cd", pt, color1, "set");
    } else if (count1 == 1){
        int pt = addpoint(0, startpos);
        addvertex(0, prim1, pt);
        setpointattrib(0, "Cd", pt, color1, "set");
    } else if (count1 > 1){

        int dstpt = hedge_dstpoint(0, hedge1);
        vector dstpos = point(0, "P", dstpt);
        int pt = addpoint(0, dstpos);
        hedge1 = hedge_next(0,hedge1);
        addvertex(0, prim1, pt);
        setpointattrib(0, "Cd", pt, color1, "set");
    }
    
    count1++;
    if (hedge2==hedge1+1)
    {
        break;
    }
}

///Second Split
hedge1 = hedge1_orig;
hedge2 = hedge2_orig;
int count2 = 0;
while(hedge1!=hedge2)
{

    if (count2==0)
    {
        int pt = addpoint(0, startpos);
        addvertex(0, prim2, pt);
        setpointattrib(0,"Cd",pt,color2);     
        
    } else if (count2==1){
        int pt = addpoint(0, foundpos);
        addvertex(0, prim2, pt);
        setpointattrib(0,"Cd",pt,color2);        
    } 
    else if (count2>1){

        int dstpt = hedge_dstpoint(0, hedge2);
        vector dstpos = point(0, "P", dstpt);
        int pt = addpoint(0, dstpos);
        hedge2 = hedge_next(0, hedge2);
        addvertex(0, prim2, pt);
        setpointattrib(0,"Cd",pt,color2);
    }
    count2++;
    
    if (hedge1 == hedge2+1)
    {
        break;
    }    
}
append(i[]@iteration, int(ite));
setprimgroup(0, "split", prim1, split, "set");
setprimgroup(0, "split", prim2, split, "set");
setprimattrib(0, "N", prim1, norm, "set");
setprimattrib(0, "N", prim2, norm, "set");
///
removeprim(0, @primnum, 1);


标签:set,pt,int,hedge2,hedge1,split,test
From: https://www.cnblogs.com/etoilest/p/17206552.html

相关文章

  • PentestLab-web安全SQL注入-EXP2
    我们打开pentestlab靶机选择“sql  injections”选择“Example2”观察页面发现name是注入点使用工具测试sqlmap参数为pythonsqlmap.py-u"http://192.168.29.148/sqli/......
  • test20230304考试总结(2023春 · 字符串)
    前言赛时得分明细:ABCDTotalRank1001000702702C题如此说道:字符串没有学好的报应!!A.P4391[BOI2009]RadioTransmission无线传输题面给定一个字......
  • Supporting integration tests with WebApplicationFactory in .NET 6
    https://andrewlock.net/exploring-dotnet-6-part-6-supporting-integration-tests-with-webapplicationfactory-in-dotnet-6/ Thisisthesixthpostintheseries:......
  • 四位计数器testbench的设计
    简单介绍一下四位计数器所要满足的条件: 1.4bit循环计数;      1,2,3,4,5,6,7,8,9,a,b,c,d,e,f,1,.......2.能同步清零;        高电平有效3.有加载功能......
  • python unittest 接口自动化遇到的问题记录
    1.ConfigParser类读取config.ini的options全部返回为小写字母查看configparser.ConfigParser类中,是因为optionxform方法返回了optionstr.lower()defoptionxform(self,......
  • test
    银河麒麟桌面操作系统V10/V10SP1日常运维FAQ1.日常操作1.查看电脑信息和激活状态操作方法右键我的电脑——属性查看,如系统已经激活则激活状态会显示“已激活”并......
  • Pytest - 分布式执行插件:xdist
    pytest-xdist分布式测试插件安装$pipinstallpytest-xdist测试代码准备classTest:deftest_sleep_2(self):sleep(2)assertFalse......
  • pytest--创建临时目录和文件
    前言在平常测试当中,可能会有一些临时数据,比如输出信息、token、临时密码等数据需要临时保存和读取。那么pytest也提供了一个fixture来支持这种情况。能够创建临时目录文......
  • AtCoder Beginner Contest 272(D,E)
    AtCoderBeginnerContest272(D,E)DD这个题最主要的是需要找出有哪些移动的距离对于题目给出的\(m\),我们的移动过程可以是\((i-ii)^2+(j-jj)^2=m\)这样的话,我们可以......
  • [vp记录] 2021 Summer Petrozavodsk Camp, Day 3: IQ test (XXII Open Cup, Grand Pri
    2021SummerPetrozavodskCamp,Day3:IQtest(XXIIOpenCup,GrandPrixofIMO)A(性质,转化)发现如果存在\(b\)中存在\(0\),那么直接构造\(b_1,0,b_2,0,\dots......