新书推介:《语义网技术体系》
作者:瞿裕忠,胡伟,程龚
   XML论坛     W3CHINA.ORG讨论区     计算机科学论坛     SOAChina论坛     Blog     开放翻译计划     新浪微博  
 
  • 首页
  • 登录
  • 注册
  • 软件下载
  • 资料下载
  • 核心成员
  • 帮助
  •   Add to Google

    >> 本版讨论SVG, GML, X3D, VRML, VML, XAML, AVALON, Batik等基于XML的图形技术,以及有关GIS的应用。
    [返回] 中文XML论坛 - 专业的XML技术讨论区XML.ORG.CN讨论区 - 高级XML应用『 SVG/GML/VRML/X3D/XAML 』 → svg中的polygon元素fill-ruler:nonzero和evenodd问题。 查看新帖用户列表

      发表一个新主题  发表一个新投票  回复主题  (订阅本版) 您是本帖的第 3683 个阅读者浏览上一篇主题  刷新本主题   树形显示贴子 浏览下一篇主题
     * 贴子主题: svg中的polygon元素fill-ruler:nonzero和evenodd问题。 举报  打印  推荐  IE收藏夹 
       本主题类别:     
     lgsh2008 帅哥哟,离线,有人找我吗?
      
      
      等级:大一(猛啃高等数学)
      文章:23
      积分:175
      门派:XML.ORG.CN
      注册:2006/4/19

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给lgsh2008发送一个短消息 把lgsh2008加入好友 查看lgsh2008的个人资料 搜索lgsh2008在『 SVG/GML/VRML/X3D/XAML 』的所有贴子 引用回复这个贴子 回复这个贴子 查看lgsh2008的博客楼主
    发贴心情 svg中的polygon元素fill-ruler:nonzero和evenodd问题。

    svg中的polygon元素fill-ruler:nonzero和evenodd问题。
    如何来计算多边形的点是在内部的还是外部的。
    <svg width="200px" height="200px" viewBox="0 0 200 200">
    <polygon style="fill-rule: nonzero; fill: yellow; stroke: black;"
    points="48,16 16,96 96,48 0,48 80,96" />
    <polygon style="fill-rule: evenodd; fill: #00ff00; stroke: black;"
    points="148,16 116,96 196,48 100,48 180,96" />
    </svg>
    此主题相关图片如下:
    按此在新窗口浏览图片

       收藏   分享  
    顶(0)
      




    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2006/6/3 12:16:00
     
     lgsh2008 帅哥哟,离线,有人找我吗?
      
      
      等级:大一(猛啃高等数学)
      文章:23
      积分:175
      门派:XML.ORG.CN
      注册:2006/4/19

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给lgsh2008发送一个短消息 把lgsh2008加入好友 查看lgsh2008的个人资料 搜索lgsh2008在『 SVG/GML/VRML/X3D/XAML 』的所有贴子 引用回复这个贴子 回复这个贴子 查看lgsh2008的博客2
    发贴心情 
    书上有这样的计算方法,但是我没明白意思

    Explanation of the Fill Rules
    For the sake of completeness, we are describing how these fill-rules work,
    but you don't need to know the details in order to use them. The nonzero rule
    determines whether a point is inside or outside a polygon by drawing a line from
    the point in question to infinity. It counts how many times that line crosses the
    polygon's lines, adding one if the polygon line is going right to left, and
    subtracting one if the polygon line is going left to right. If the total comes out to
    zero, the point is outside the polygon. If the total is nonzero (hence the name)
    the point is inside the polygon.
    The evenodd rule also draws a line from the point in question to infinity, but it
    simply counts how many times that line crosses your polygon's lines. If the total
    number of crossings is odd, then the point is inside; if even, then the point is
    outside.

    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2006/6/3 12:18:00
     
     tamefox 美女呀,离线,快来找我吧!魔羯座1980-1-1
      
      
      威望:1
      等级:大四(每天看1小时莱昂氏)
      文章:129
      积分:1236
      门派:XML.ORG.CN
      注册:2005/7/6

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给tamefox发送一个短消息 把tamefox加入好友 查看tamefox的个人资料 搜索tamefox在『 SVG/GML/VRML/X3D/XAML 』的所有贴子 引用回复这个贴子 回复这个贴子 查看tamefox的博客3
    发贴心情 
    从该点画一条无线长的射线,计算该线与polygon线的交点,如果使用的是nonzero填充,则若色射线与polygon相交时polygon线的绘制方向为逆时针,则交点个数加一;若为顺时针,则交点个数减一。若最终交点个数为0,则该点在polygon的外部,否则在polygon的内部。如果使用evenodd填充,则交点数目为实际的交点数据。如果个数为奇数,则该点在polygon的内部,如果是偶数,则该点在polygon的外部。
    其实你只要按照人家给的图,然后自己在纸上画一下就能明白,另外可以仔细看一下《基于XML的SVG应用指南》

    ----------------------------------------------
    无为而无所不为
    有为而有所不为

    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2006/6/4 14:42:00
     
     GoogleAdSense魔羯座1980-1-1
      
      
      等级:大一新生
      文章:1
      积分:50
      门派:无门无派
      院校:未填写
      注册:2007-01-01
    给Google AdSense发送一个短消息 把Google AdSense加入好友 查看Google AdSense的个人资料 搜索Google AdSense在『 SVG/GML/VRML/X3D/XAML 』的所有贴子 访问Google AdSense的主页 引用回复这个贴子 回复这个贴子 查看Google AdSense的博客广告
    2025/8/3 9:49:03

    本主题贴数3,分页: [1]

    管理选项修改tag | 锁定 | 解锁 | 提升 | 删除 | 移动 | 固顶 | 总固顶 | 奖励 | 惩罚 | 发布公告
    W3C Contributing Supporter! W 3 C h i n a ( since 2003 ) 旗 下 站 点
    苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
    62.500ms