├── avl.version ├── ParmGearMenuenu.xml ├── .gitignore ├── otls ├── avl__avg__1_0.hda ├── avl__max__1_0.hda ├── avl__min__1_0.hda ├── avl__sum__1_0.hda ├── avl__angle__1_0.hda ├── avl__count__1_0.hda ├── avl__median__1_0.hda ├── avl__python__1_0.hda ├── avl__resize__1_0.hda ├── avl__round__1_0.hda ├── avl__shift__1_0.hda ├── avl__unique__1_0.hda ├── avl__update__1_0.hda ├── avl__distance2__1_0.hda ├── avl__isinside__1_0.hda ├── avl__length2__1_0.hda ├── avl__padzero__1_0.hda ├── avl__pointedge__1_0.hda ├── avl__primarea__1_0.hda ├── avl__primhedge__1_0.hda ├── avl__product__1_0.hda ├── avl__splitext__1_0.hda ├── avl__array_range__1_0.hda ├── avl__edgegroups__1_0.hda ├── avl__hedge_next__1_0.hda ├── avl__hedge_prev__1_0.hda ├── avl__hedge_prim__1_0.hda ├── avl__isinsphere__1_0.hda ├── avl__nearpoints__1_0.hda ├── avl__pointgroups__1_0.hda ├── avl__pointhedge__1_0.hda ├── avl__primattribs__1_0.hda ├── avl__primgroups__1_0.hda ├── avl__primvolume__1_0.hda ├── avl__vertexhedge__1_0.hda ├── avl__copyedgegroup__1_0.hda ├── avl__copyedgegroups__1_0.hda ├── avl__copypointgroup__1_0.hda ├── avl__copyprimattrib__1_0.hda ├── avl__copyprimgroup__1_0.hda ├── avl__copyprimgroups__1_0.hda ├── avl__detailattribs__1_0.hda ├── avl__hedge_dstpoint__1_0.hda ├── avl__hedge_dstpos__1_0.hda ├── avl__hedge_isequiv__1_0.hda ├── avl__hedge_isvalid__1_0.hda ├── avl__hedge_opposite__1_0.hda ├── avl__hedge_primary__1_0.hda ├── avl__hedge_srcpoint__1_0.hda ├── avl__hedge_srcpos__1_0.hda ├── avl__isalmostequal__1_0.hda ├── avl__pixelwrangle__1_0.hda ├── avl__pointattribs__1_0.hda ├── avl__pointcurvature__1_0.hda ├── avl__pointhedgenext__1_0.hda ├── avl__polyneighbours__1_0.hda ├── avl__primperimeter__1_0.hda ├── avl__setedgegroup__1_0.hda ├── avl__trianglearea__1_0.hda ├── avl__trianglenormal__1_0.hda ├── avl__vertexattribs__1_0.hda ├── avl__vertexgroups__1_0.hda ├── avl__xformwrangle__1_0.hda ├── avl__copydetailattrib__1_0.hda ├── avl__copypointattrib__1_0.hda ├── avl__copypointattribs__1_0.hda ├── avl__copypointgroups__1_0.hda ├── avl__copyprimattribs__1_0.hda ├── avl__copyvertexattrib__1_0.hda ├── avl__copyvertexgroup__1_0.hda ├── avl__copyvertexgroups__1_0.hda ├── avl__hedge_dstvertex__1_0.hda ├── avl__hedge_equivcount__1_0.hda ├── avl__hedge_isprimary__1_0.hda ├── avl__hedge_nextequiv__1_0.hda ├── avl__hedge_postdstpos__1_0.hda ├── avl__hedge_presrcpos__1_0.hda ├── avl__hedge_srcvertex__1_0.hda ├── avl__normalizevalues__1_0.hda ├── avl__shiftvertexorder__1_0.hda ├── avl__copydetailattribs__1_0.hda ├── avl__copyvertexattribs__1_0.hda ├── avl__hedge_postdstpoint__1_0.hda ├── avl__hedge_postdstvertex__1_0.hda ├── avl__hedge_presrcpoint__1_0.hda ├── avl__hedge_presrcvertex__1_0.hda ├── avl__reversevertexorder__1_0.hda └── avl__sphericaldistance__1_0.hda ├── vex ├── include │ ├── avl_tostr.h │ ├── avl_clamp01.h │ ├── avl_clamp11.h │ ├── avl_isodd.h │ ├── avl_iseven.h │ ├── avl_version.h │ ├── avl_print.h │ ├── avl_padzero.h │ ├── avl_spherearea.h │ ├── avl_circlearea.h │ ├── avl_circlelength.h │ ├── avl_spherevolume.h │ ├── avl_primcentroid.h │ ├── avl_sphericaldistance.h │ ├── avl_edgegroups.h │ ├── avl_primgroups.h │ ├── avl_ispolyline.h │ ├── avl_pointgroups.h │ ├── avl_primnormal.h │ ├── avl_vertexgroups.h │ ├── avl_isclosed.h │ ├── avl_pointattribs.h │ ├── avl_primattribs.h │ ├── avl_detailattribs.h │ ├── avl_vertexattribs.h │ ├── avl_primarea.h │ ├── avl_frompolar.h │ ├── avl_triangulate.h │ ├── avl_primtypename.h │ ├── avl_primvolume.h │ ├── avl_hedge_dstpos.h │ ├── avl_hedge_srcpos.h │ ├── avl_limits.h │ ├── avl_primperimeter.h │ ├── avl_incircle.h │ ├── avl_insphere.h │ ├── avl_polysplit.h │ ├── avl_hedge_presrcpos.h │ ├── avl_hedge_postdstpos.h │ ├── avl_pointnormal.h │ ├── avl_topolar.h │ ├── avl_colors.h │ ├── avl_splitext.h │ ├── avl_mode.h │ ├── avl_angle.h │ ├── avl_reversevertexorder.h │ ├── avl_inrect.h │ ├── avl_removeduplicates.h │ ├── avl_shiftvertexorder.h │ ├── avl_medianhigh.h │ ├── avl_medianlow.h │ ├── avl_getbbox_volume.h │ ├── avl_trinormal.h │ ├── avl_getpointbbox_volume.h │ ├── avl_polyperimeter.h │ ├── avl_copypointgroup.h │ ├── avl_copyprimgroup.h │ ├── avl_diff.h │ ├── avl_getbbox_area.h │ ├── avl_copyvertexgroup.h │ ├── avl_tricentroid.h │ ├── avl_getpointbbox_area.h │ ├── avl_trivolume.h │ ├── avl_inside.h │ ├── avl_maxindex.h │ ├── avl_minindex.h │ ├── avl_randint.h │ ├── avl_filepath.h │ ├── avl_copypoint.h │ ├── avl_median.h │ ├── avl_polyvolume.h │ ├── avl_copydetailattribs.h │ ├── avl_primtype.h │ ├── avl_copyedgegroup.h │ ├── avl_pointcurvature.h │ ├── avl_setedgegroup.h │ ├── avl_hedge_opposite.h │ ├── avl_assert.h │ ├── avl_triperimeter.h │ ├── avl_shuffle.h │ ├── avl_triarea.h │ ├── avl_copypointattribs.h │ ├── avl_copypointgroups.h │ ├── avl_copyprimgroups.h │ ├── avl_copyprimattribs.h │ ├── avl_copyvertexgroups.h │ ├── avl_istiny.h │ ├── avl_removevertex.h │ ├── avl_copyvertexattribs.h │ ├── avl_sample.h │ ├── avl_vertexnormal.h │ ├── avl_swap.h │ ├── avl_normalizevalues.h │ ├── avl_inpointbbox.h │ ├── avl_polyarea.h │ ├── avl_isflat.h │ ├── avl_inbbox.h │ ├── avl_copyedgegroups.h │ ├── avl_range.h │ ├── avl_almostequal.h │ ├── avl_polycentroid.h │ ├── avl_round.h │ ├── avl_choice.h │ ├── avl_polyneighbours.h │ ├── avl_copyprim.h │ ├── avl_unique.h │ ├── avl_in.h │ ├── avl_shift.h │ ├── avl_count.h │ ├── avl_polyextrude.h │ ├── avl.h │ ├── avl_randrange.h │ ├── avl_copydetailattrib.h │ └── avl_copypointattrib.h └── test │ ├── run.py │ └── avl_test.vfl ├── config └── Help │ └── bookish.cfg ├── help ├── vex │ ├── avl_limits.txt │ ├── functions │ │ ├── avl_colors.txt │ │ ├── avl_limits.txt │ │ ├── avl_edgegroups.txt │ │ ├── avl_pointgroups.txt │ │ ├── avl_primgroups.txt │ │ ├── avl_vertexgroups.txt │ │ ├── avl_pointattribs.txt │ │ ├── avl_detailattribs.txt │ │ ├── avl_primattribs.txt │ │ ├── avl_vertexattribs.txt │ │ ├── avl_shift.txt │ │ ├── avl_print.txt │ │ ├── avl_primarea.txt │ │ ├── avl_primvolume.txt │ │ ├── avl_unique.txt │ │ ├── avl_primperimeter.txt │ │ ├── avl_inside.txt │ │ ├── avl_padzero.txt │ │ ├── avl_trianglenormal.txt │ │ ├── avl_maxindex.txt │ │ ├── avl_minindex.txt │ │ ├── avl_swap.txt │ │ ├── avl_angle.txt │ │ ├── _avl_common.txt │ │ ├── avl_hedge_srcpos.txt │ │ ├── avl_hedge_dstpos.txt │ │ ├── avl_hedge_presrcpos.txt │ │ ├── avl_insphere.txt │ │ ├── avl_count.txt │ │ ├── avl_hedge_postdstpos.txt │ │ ├── avl_medianlow.txt │ │ ├── avl_medianhigh.txt │ │ ├── avl_median.txt │ │ ├── avl_trianglearea.txt │ │ ├── avl_polyneighbours.txt │ │ ├── avl_clamp01.txt │ │ ├── avl_clamp11.txt │ │ ├── avl_round.txt │ │ ├── avl_normalizevalues.txt │ │ └── avl_removevertex.txt │ ├── avl_colors.txt │ └── avl.txt └── nodes │ └── vop │ ├── _avl_common.txt │ ├── avl__primarea__1_0.txt │ └── avl--primarea-1.0.txt ├── .github └── ISSUE_TEMPLATE │ └── some-useful-function.md ├── PARMmenu.xml ├── toolbar └── avl.shelf ├── OPmenu.xml └── MainMenuCommon.xml /avl.version: -------------------------------------------------------------------------------- 1 | 1.0.0 -------------------------------------------------------------------------------- /ParmGearMenuenu.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | otls/backup/ 2 | -------------------------------------------------------------------------------- /otls/avl__avg__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__avg__1_0.hda -------------------------------------------------------------------------------- /otls/avl__max__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__max__1_0.hda -------------------------------------------------------------------------------- /otls/avl__min__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__min__1_0.hda -------------------------------------------------------------------------------- /otls/avl__sum__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__sum__1_0.hda -------------------------------------------------------------------------------- /otls/avl__angle__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__angle__1_0.hda -------------------------------------------------------------------------------- /otls/avl__count__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__count__1_0.hda -------------------------------------------------------------------------------- /otls/avl__median__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__median__1_0.hda -------------------------------------------------------------------------------- /otls/avl__python__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__python__1_0.hda -------------------------------------------------------------------------------- /otls/avl__resize__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__resize__1_0.hda -------------------------------------------------------------------------------- /otls/avl__round__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__round__1_0.hda -------------------------------------------------------------------------------- /otls/avl__shift__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__shift__1_0.hda -------------------------------------------------------------------------------- /otls/avl__unique__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__unique__1_0.hda -------------------------------------------------------------------------------- /otls/avl__update__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__update__1_0.hda -------------------------------------------------------------------------------- /otls/avl__distance2__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__distance2__1_0.hda -------------------------------------------------------------------------------- /otls/avl__isinside__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__isinside__1_0.hda -------------------------------------------------------------------------------- /otls/avl__length2__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__length2__1_0.hda -------------------------------------------------------------------------------- /otls/avl__padzero__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__padzero__1_0.hda -------------------------------------------------------------------------------- /otls/avl__pointedge__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__pointedge__1_0.hda -------------------------------------------------------------------------------- /otls/avl__primarea__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__primarea__1_0.hda -------------------------------------------------------------------------------- /otls/avl__primhedge__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__primhedge__1_0.hda -------------------------------------------------------------------------------- /otls/avl__product__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__product__1_0.hda -------------------------------------------------------------------------------- /otls/avl__splitext__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__splitext__1_0.hda -------------------------------------------------------------------------------- /otls/avl__array_range__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__array_range__1_0.hda -------------------------------------------------------------------------------- /otls/avl__edgegroups__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__edgegroups__1_0.hda -------------------------------------------------------------------------------- /otls/avl__hedge_next__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__hedge_next__1_0.hda -------------------------------------------------------------------------------- /otls/avl__hedge_prev__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__hedge_prev__1_0.hda -------------------------------------------------------------------------------- /otls/avl__hedge_prim__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__hedge_prim__1_0.hda -------------------------------------------------------------------------------- /otls/avl__isinsphere__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__isinsphere__1_0.hda -------------------------------------------------------------------------------- /otls/avl__nearpoints__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__nearpoints__1_0.hda -------------------------------------------------------------------------------- /otls/avl__pointgroups__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__pointgroups__1_0.hda -------------------------------------------------------------------------------- /otls/avl__pointhedge__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__pointhedge__1_0.hda -------------------------------------------------------------------------------- /otls/avl__primattribs__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__primattribs__1_0.hda -------------------------------------------------------------------------------- /otls/avl__primgroups__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__primgroups__1_0.hda -------------------------------------------------------------------------------- /otls/avl__primvolume__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__primvolume__1_0.hda -------------------------------------------------------------------------------- /otls/avl__vertexhedge__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__vertexhedge__1_0.hda -------------------------------------------------------------------------------- /otls/avl__copyedgegroup__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__copyedgegroup__1_0.hda -------------------------------------------------------------------------------- /otls/avl__copyedgegroups__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__copyedgegroups__1_0.hda -------------------------------------------------------------------------------- /otls/avl__copypointgroup__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__copypointgroup__1_0.hda -------------------------------------------------------------------------------- /otls/avl__copyprimattrib__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__copyprimattrib__1_0.hda -------------------------------------------------------------------------------- /otls/avl__copyprimgroup__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__copyprimgroup__1_0.hda -------------------------------------------------------------------------------- /otls/avl__copyprimgroups__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__copyprimgroups__1_0.hda -------------------------------------------------------------------------------- /otls/avl__detailattribs__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__detailattribs__1_0.hda -------------------------------------------------------------------------------- /otls/avl__hedge_dstpoint__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__hedge_dstpoint__1_0.hda -------------------------------------------------------------------------------- /otls/avl__hedge_dstpos__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__hedge_dstpos__1_0.hda -------------------------------------------------------------------------------- /otls/avl__hedge_isequiv__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__hedge_isequiv__1_0.hda -------------------------------------------------------------------------------- /otls/avl__hedge_isvalid__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__hedge_isvalid__1_0.hda -------------------------------------------------------------------------------- /otls/avl__hedge_opposite__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__hedge_opposite__1_0.hda -------------------------------------------------------------------------------- /otls/avl__hedge_primary__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__hedge_primary__1_0.hda -------------------------------------------------------------------------------- /otls/avl__hedge_srcpoint__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__hedge_srcpoint__1_0.hda -------------------------------------------------------------------------------- /otls/avl__hedge_srcpos__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__hedge_srcpos__1_0.hda -------------------------------------------------------------------------------- /otls/avl__isalmostequal__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__isalmostequal__1_0.hda -------------------------------------------------------------------------------- /otls/avl__pixelwrangle__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__pixelwrangle__1_0.hda -------------------------------------------------------------------------------- /otls/avl__pointattribs__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__pointattribs__1_0.hda -------------------------------------------------------------------------------- /otls/avl__pointcurvature__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__pointcurvature__1_0.hda -------------------------------------------------------------------------------- /otls/avl__pointhedgenext__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__pointhedgenext__1_0.hda -------------------------------------------------------------------------------- /otls/avl__polyneighbours__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__polyneighbours__1_0.hda -------------------------------------------------------------------------------- /otls/avl__primperimeter__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__primperimeter__1_0.hda -------------------------------------------------------------------------------- /otls/avl__setedgegroup__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__setedgegroup__1_0.hda -------------------------------------------------------------------------------- /otls/avl__trianglearea__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__trianglearea__1_0.hda -------------------------------------------------------------------------------- /otls/avl__trianglenormal__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__trianglenormal__1_0.hda -------------------------------------------------------------------------------- /otls/avl__vertexattribs__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__vertexattribs__1_0.hda -------------------------------------------------------------------------------- /otls/avl__vertexgroups__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__vertexgroups__1_0.hda -------------------------------------------------------------------------------- /otls/avl__xformwrangle__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__xformwrangle__1_0.hda -------------------------------------------------------------------------------- /otls/avl__copydetailattrib__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__copydetailattrib__1_0.hda -------------------------------------------------------------------------------- /otls/avl__copypointattrib__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__copypointattrib__1_0.hda -------------------------------------------------------------------------------- /otls/avl__copypointattribs__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__copypointattribs__1_0.hda -------------------------------------------------------------------------------- /otls/avl__copypointgroups__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__copypointgroups__1_0.hda -------------------------------------------------------------------------------- /otls/avl__copyprimattribs__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__copyprimattribs__1_0.hda -------------------------------------------------------------------------------- /otls/avl__copyvertexattrib__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__copyvertexattrib__1_0.hda -------------------------------------------------------------------------------- /otls/avl__copyvertexgroup__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__copyvertexgroup__1_0.hda -------------------------------------------------------------------------------- /otls/avl__copyvertexgroups__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__copyvertexgroups__1_0.hda -------------------------------------------------------------------------------- /otls/avl__hedge_dstvertex__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__hedge_dstvertex__1_0.hda -------------------------------------------------------------------------------- /otls/avl__hedge_equivcount__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__hedge_equivcount__1_0.hda -------------------------------------------------------------------------------- /otls/avl__hedge_isprimary__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__hedge_isprimary__1_0.hda -------------------------------------------------------------------------------- /otls/avl__hedge_nextequiv__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__hedge_nextequiv__1_0.hda -------------------------------------------------------------------------------- /otls/avl__hedge_postdstpos__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__hedge_postdstpos__1_0.hda -------------------------------------------------------------------------------- /otls/avl__hedge_presrcpos__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__hedge_presrcpos__1_0.hda -------------------------------------------------------------------------------- /otls/avl__hedge_srcvertex__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__hedge_srcvertex__1_0.hda -------------------------------------------------------------------------------- /otls/avl__normalizevalues__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__normalizevalues__1_0.hda -------------------------------------------------------------------------------- /otls/avl__shiftvertexorder__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__shiftvertexorder__1_0.hda -------------------------------------------------------------------------------- /otls/avl__copydetailattribs__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__copydetailattribs__1_0.hda -------------------------------------------------------------------------------- /otls/avl__copyvertexattribs__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__copyvertexattribs__1_0.hda -------------------------------------------------------------------------------- /otls/avl__hedge_postdstpoint__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__hedge_postdstpoint__1_0.hda -------------------------------------------------------------------------------- /otls/avl__hedge_postdstvertex__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__hedge_postdstvertex__1_0.hda -------------------------------------------------------------------------------- /otls/avl__hedge_presrcpoint__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__hedge_presrcpoint__1_0.hda -------------------------------------------------------------------------------- /otls/avl__hedge_presrcvertex__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__hedge_presrcvertex__1_0.hda -------------------------------------------------------------------------------- /otls/avl__reversevertexorder__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__reversevertexorder__1_0.hda -------------------------------------------------------------------------------- /otls/avl__sphericaldistance__1_0.hda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivantitov-zd/AVL/HEAD/otls/avl__sphericaldistance__1_0.hda -------------------------------------------------------------------------------- /vex/include/avl_tostr.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_TOSTR_H_ 3 | #define _AVL_TOSTR_H_ 4 | 5 | #define avl_tostr(VALUE) sprintf('%g', VALUE) 6 | 7 | #endif // _AVL_TOSTR_H_ 8 | -------------------------------------------------------------------------------- /vex/include/avl_clamp01.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_CLAMP01_H_ 3 | #define _AVL_CLAMP01_H_ 4 | 5 | #define avl_clamp01(VALUE) clamp(VALUE, 0, 1) 6 | 7 | #endif // _AVL_CLAMP01_H_ 8 | -------------------------------------------------------------------------------- /vex/include/avl_clamp11.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_CLAMP11_H_ 3 | #define _AVL_CLAMP11_H_ 4 | 5 | #define avl_clamp11(VALUE) clamp(VALUE, -1, 1) 6 | 7 | #endif // _AVL_CLAMP11_H_ 8 | -------------------------------------------------------------------------------- /config/Help/bookish.cfg: -------------------------------------------------------------------------------- 1 | EXTRA_SHORTCUTS = [ 2 | { 3 | 'shortcut': 'av', 4 | 'query': 'tags:avl', 5 | 'desc': 'Advanced VEX Library Nodes and Functions' 6 | } 7 | ] 8 | -------------------------------------------------------------------------------- /help/vex/avl_limits.txt: -------------------------------------------------------------------------------- 1 | = AVL |> Type Limit Constants = 2 | 3 | #icon: CHOP/limit 4 | #parent: avl 5 | 6 | """Type limit constants contained in the avl_limits.h.""" 7 | 8 | Todo (1.0): type limits table 9 | -------------------------------------------------------------------------------- /vex/include/avl_isodd.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_ISODD_H_ 3 | #define _AVL_ISODD_H_ 4 | 5 | int 6 | avl_isodd(const int value) 7 | { 8 | return value & 1; 9 | } 10 | 11 | #endif // _AVL_ISODD_H_ 12 | -------------------------------------------------------------------------------- /vex/include/avl_iseven.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_ISEVEN_H_ 3 | #define _AVL_ISEVEN_H_ 4 | 5 | int 6 | avl_iseven(const int value) 7 | { 8 | return (value & 1) == 0; 9 | } 10 | 11 | #endif // _AVL_ISEVEN_H_ 12 | -------------------------------------------------------------------------------- /help/nodes/vop/_avl_common.txt: -------------------------------------------------------------------------------- 1 | #type: include 2 | 3 | :warning: 4 | #id: not_std_lib 5 | 6 | Please note that this VOP is not included in the standard Houdini library, but is part of the [Advanced VEX Library|/vex/avl]. 7 | -------------------------------------------------------------------------------- /help/vex/functions/avl_colors.txt: -------------------------------------------------------------------------------- 1 | = avl_colors = 2 | 3 | #type: vex 4 | #context: all 5 | #tags: color, avl 6 | #group: color 7 | #redirect: /vex/avl_colors 8 | // Todo (1.0): redirection 9 | """Contains color constants.""" 10 | -------------------------------------------------------------------------------- /help/vex/functions/avl_limits.txt: -------------------------------------------------------------------------------- 1 | = avl_limits = 2 | 3 | #type: vex 4 | #context: all 5 | #tags: color, avl 6 | #group: color 7 | #redirect: /vex/avl_limits 8 | // Todo (1.0): redirection 9 | """Contains type limit constants.""" 10 | -------------------------------------------------------------------------------- /vex/include/avl_version.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_VERSION_H_ 3 | #define _AVL_VERSION_H_ 4 | 5 | #define AVL_VERSION_MAJOR 1 6 | #define AVL_VERSION_MINOR 0 7 | #define AVL_VERSION_PATCH 0 8 | 9 | #endif // _AVL_VERSION_H_ 10 | -------------------------------------------------------------------------------- /vex/include/avl_print.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_PRINT_H_ 3 | #define _AVL_PRINT_H_ 4 | 5 | #define avl_print(VALUE) printf('%g\n', VALUE) 6 | 7 | // Todo (2.0): void avl_print(const ...) 8 | 9 | #endif // _AVL_PRINT_H_ 10 | -------------------------------------------------------------------------------- /help/vex/avl_colors.txt: -------------------------------------------------------------------------------- 1 | = AVL |> Color Constants = 2 | 3 | #icon: SOP/color 4 | #parent: avl 5 | 6 | """Color constants contained in the avl_colors.h.""" 7 | 8 | Well, there is red, green, blue and gray. 9 | 10 | Todo (1.0): color table 11 | -------------------------------------------------------------------------------- /vex/include/avl_padzero.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_PADZERO_H_ 3 | #define _AVL_PADZERO_H_ 4 | 5 | string 6 | avl_padzero(const int value; const int size) 7 | { 8 | return sprintf('%*0d', size, value); 9 | } 10 | 11 | #endif // _AVL_PADZERO_H_ 12 | -------------------------------------------------------------------------------- /vex/include/avl_spherearea.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_SPHEREAREA_H_ 3 | #define _AVL_SPHEREAREA_H_ 4 | 5 | float 6 | avl_spherearea(const float radius) 7 | { 8 | return 12.566370614359172 * radius * radius; 9 | } 10 | 11 | #endif // _AVL_SPHEREAREA_H_ 12 | -------------------------------------------------------------------------------- /help/nodes/vop/avl__primarea__1_0.txt: -------------------------------------------------------------------------------- 1 | #type: node 2 | #context: vop 3 | #namespace: avl 4 | #internal: primarea 5 | #version: 1.0 6 | #icon: SOP/measure 7 | #tags: avl 8 | #redirect: avl--primarea-1.0 9 | 10 | = Primitive Area AVL = 11 | 12 | [Include:avl--primarea-1.0] 13 | -------------------------------------------------------------------------------- /vex/include/avl_circlearea.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_CIRCLEAREA_H_ 3 | #define _AVL_CIRCLEAREA_H_ 4 | 5 | #include 6 | 7 | float 8 | avl_circlearea(const float radius) 9 | { 10 | return M_PI * radius * radius; 11 | } 12 | 13 | #endif // _AVL_CIRCLEAREA_H_ 14 | -------------------------------------------------------------------------------- /vex/include/avl_circlelength.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_CIRCLELENGTH_H_ 3 | #define _AVL_CIRCLELENGTH_H_ 4 | 5 | #include 6 | 7 | float 8 | avl_circlelength(const float radius) 9 | { 10 | return M_TWO_PI * radius; 11 | } 12 | 13 | #endif // _AVL_CIRCLELENGTH_H_ 14 | -------------------------------------------------------------------------------- /vex/include/avl_spherevolume.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_SPHEREVOLUME_H_ 3 | #define _AVL_SPHEREVOLUME_H_ 4 | 5 | float 6 | avl_spherevolume(const float radius) 7 | { 8 | return 4.1887902047863909 * radius * radius * radius; 9 | } 10 | 11 | #endif // _AVL_SPHEREVOLUME_H_ 12 | -------------------------------------------------------------------------------- /vex/include/avl_primcentroid.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_PRIMCENTROID_H_ 3 | #define _AVL_PRIMCENTROID_H_ 4 | 5 | // Todo (1.0): vector avl_primcentroid(const int geometry; const int primnum) 6 | 7 | // Todo (1.0): vector avl_primcentroid(const string geometry; const int primnum) 8 | 9 | #endif // _AVL_PRIMCENTROID_H_ 10 | -------------------------------------------------------------------------------- /help/nodes/vop/avl--primarea-1.0.txt: -------------------------------------------------------------------------------- 1 | #type: node 2 | #context: vop 3 | #namespace: avl 4 | #internal: primarea 5 | #version: 1.0 6 | #icon: SOP/measure 7 | #tags: avl 8 | 9 | = Primitive Area AVL = 10 | 11 | """Returns the area of the primitive.""" 12 | 13 | If the operation fails, the result is 0. 14 | 15 | [Include:_avl_common#not_std_lib] 16 | -------------------------------------------------------------------------------- /help/vex/functions/avl_edgegroups.txt: -------------------------------------------------------------------------------- 1 | = avl_edgegroups = 2 | 3 | #type: vex 4 | #context: all 5 | #tags: groups, avl 6 | #group: groups 7 | 8 | """Returns a list of edge groups.""" 9 | 10 | :usage: `string[] avl_edgegroups()` 11 | 12 | [Include:_common#geometry] 13 | 14 | :returns: 15 | Returns a list of edge groups. 16 | 17 | [Include:_avl_common#not_std] 18 | -------------------------------------------------------------------------------- /help/vex/functions/avl_pointgroups.txt: -------------------------------------------------------------------------------- 1 | = avl_pointgroups = 2 | 3 | #type: vex 4 | #context: all 5 | #tags: groups, avl 6 | #group: groups 7 | 8 | """Returns a list of point groups.""" 9 | 10 | :usage: `string[] avl_pointgroups()` 11 | 12 | [Include:_common#geometry] 13 | 14 | :returns: 15 | Returns a list of point groups. 16 | 17 | [Include:_avl_common#not_std] 18 | -------------------------------------------------------------------------------- /help/vex/functions/avl_primgroups.txt: -------------------------------------------------------------------------------- 1 | = avl_primgroups = 2 | 3 | #type: vex 4 | #context: all 5 | #tags: groups, avl 6 | #group: groups 7 | 8 | """Returns a list of primitive groups.""" 9 | 10 | :usage: `string[] avl_primgroups()` 11 | 12 | [Include:_common#geometry] 13 | 14 | :returns: 15 | Returns a list of primitive groups. 16 | 17 | [Include:_avl_common#not_std] 18 | -------------------------------------------------------------------------------- /help/vex/functions/avl_vertexgroups.txt: -------------------------------------------------------------------------------- 1 | = avl_vertexgroups = 2 | 3 | #type: vex 4 | #context: all 5 | #tags: groups, avl 6 | #group: groups 7 | 8 | """Returns a list of vertex groups.""" 9 | 10 | :usage: `string[] avl_vertexgroups()` 11 | 12 | [Include:_common#geometry] 13 | 14 | :returns: 15 | Returns a list of vertex groups. 16 | 17 | [Include:_avl_common#not_std] 18 | -------------------------------------------------------------------------------- /vex/include/avl_sphericaldistance.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_SPHERICALDISTANCE_H_ 3 | #define _AVL_SPHERICALDISTANCE_H_ 4 | 5 | // #include "avl_angle.h" 6 | 7 | float 8 | avl_sphericaldistance(const vector position1; const vector position2) 9 | { 10 | return acos(dot(position1, position2)) * float(length(position1)); 11 | } 12 | 13 | #endif // _AVL_SPHERICALDISTANCE_H_ 14 | -------------------------------------------------------------------------------- /help/vex/functions/avl_pointattribs.txt: -------------------------------------------------------------------------------- 1 | = avl_pointattribs = 2 | 3 | #type: vex 4 | #context: all 5 | #tags: attrib, avl 6 | #group: attrib 7 | 8 | """Returns a list of point attributes.""" 9 | 10 | :usage: `string[] avl_pointattribs()` 11 | 12 | [Include:_common#geometry] 13 | 14 | :returns: 15 | Returns a list of point attributes. 16 | 17 | [Include:_avl_common#not_std] 18 | -------------------------------------------------------------------------------- /help/vex/functions/avl_detailattribs.txt: -------------------------------------------------------------------------------- 1 | = avl_detailattribs = 2 | 3 | #type: vex 4 | #context: all 5 | #tags: attrib, avl 6 | #group: attrib 7 | 8 | """Returns a list of detail attributes.""" 9 | 10 | :usage: `string[] avl_detailattribs()` 11 | 12 | [Include:_common#geometry] 13 | 14 | :returns: 15 | Returns a list of detail attributes. 16 | 17 | [Include:_avl_common#not_std] 18 | -------------------------------------------------------------------------------- /help/vex/functions/avl_primattribs.txt: -------------------------------------------------------------------------------- 1 | = avl_primattribs = 2 | 3 | #type: vex 4 | #context: all 5 | #tags: attrib, avl 6 | #group: attrib 7 | 8 | """Returns a list of primitive attributes.""" 9 | 10 | :usage: `string[] avl_primattribs()` 11 | 12 | [Include:_common#geometry] 13 | 14 | :returns: 15 | Returns a list of primitive attributes. 16 | 17 | [Include:_avl_common#not_std] 18 | -------------------------------------------------------------------------------- /help/vex/functions/avl_vertexattribs.txt: -------------------------------------------------------------------------------- 1 | = avl_vertexattribs = 2 | 3 | #type: vex 4 | #context: all 5 | #tags: attrib, avl 6 | #group: attrib 7 | 8 | """Returns a list of vertex attributes.""" 9 | 10 | :usage: `string[] avl_vertexattribs()` 11 | 12 | [Include:_common#geometry] 13 | 14 | :returns: 15 | Returns a list of vertex attributes. 16 | 17 | [Include:_avl_common#not_std] 18 | -------------------------------------------------------------------------------- /vex/include/avl_edgegroups.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_EDGEGROUPS_H_ 3 | #define _AVL_EDGEGROUPS_H_ 4 | 5 | string[] 6 | avl_edgegroups(const int geometry) 7 | { 8 | return detailintrinsic(geometry, 'edgegroups'); 9 | } 10 | 11 | string[] 12 | avl_edgegroups(const string geometry) 13 | { 14 | return detailintrinsic(geometry, 'edgegroups'); 15 | } 16 | 17 | #endif // _AVL_EDGEGROUPS_H_ 18 | -------------------------------------------------------------------------------- /help/vex/functions/avl_shift.txt: -------------------------------------------------------------------------------- 1 | = avl_shift = 2 | 3 | #type: vex 4 | #context: all 5 | #tags: array, avl 6 | #group: array 7 | 8 | """Shifts array elements by n positions.""" 9 | 10 | :usage: `[] avl_shift( sequence[])` 11 | 12 | :arg:sequence: 13 | Array with values. 14 | 15 | :returns: 16 | Returns the new array with shifted elements. 17 | 18 | [Include:_avl_common#not_std] 19 | -------------------------------------------------------------------------------- /vex/include/avl_primgroups.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_PRIMGROUPS_H_ 3 | #define _AVL_PRIMGROUPS_H_ 4 | 5 | string[] 6 | avl_primgroups(const int geometry) 7 | { 8 | return detailintrinsic(geometry, 'primitivegroups'); 9 | } 10 | 11 | string[] 12 | avl_primgroups(const string geometry) 13 | { 14 | return detailintrinsic(geometry, 'primitivegroups'); 15 | } 16 | 17 | #endif // _AVL_PRIMGROUPS_H_ 18 | -------------------------------------------------------------------------------- /vex/include/avl_ispolyline.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_ISPOLYLINE_H_ 3 | #define _AVL_ISPOLYLINE_H_ 4 | 5 | #include "avl_primtype.h" 6 | #include "avl_isclosed.h" 7 | 8 | int 9 | avl_ispolyline(const int geometry; const int primnum) 10 | { 11 | return avl_primtype(geometry, primnum) == AVL_PRIMTYPE_POLY && 12 | !avl_isclosed(geometry, primnum); 13 | } 14 | 15 | #endif // _AVL_ISPOLYLINE_H_ 16 | -------------------------------------------------------------------------------- /vex/include/avl_pointgroups.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_POINTGROUPS_H_ 3 | #define _AVL_POINTGROUPS_H_ 4 | 5 | 6 | string[] 7 | avl_pointgroups(const int geometry) 8 | { 9 | return detailintrinsic(geometry, 'pointgroups'); 10 | } 11 | 12 | string[] 13 | avl_pointgroups(const string geometry) 14 | { 15 | return detailintrinsic(geometry, 'pointgroups'); 16 | } 17 | 18 | #endif // _AVL_POINTGROUPS_H_ 19 | -------------------------------------------------------------------------------- /vex/include/avl_primnormal.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_PRIMNORMAL_H_ 3 | #define _AVL_PRIMNORMAL_H_ 4 | 5 | vector 6 | avl_primnormal(int geometry; int primnum) 7 | { 8 | return prim_normal(geometry, primnum, 0.5, 0.5); 9 | } 10 | 11 | vector 12 | avl_primnormal(string geometry; int primnum) 13 | { 14 | return prim_normal(geometry, primnum, 0.5, 0.5); 15 | } 16 | 17 | #endif // _AVL_PRIMNORMAL_H_ 18 | -------------------------------------------------------------------------------- /vex/include/avl_vertexgroups.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_VERTEXGROUPS_H_ 3 | #define _AVL_VERTEXGROUPS_H_ 4 | 5 | string[] 6 | avl_vertexgroups(const int geometry) 7 | { 8 | return detailintrinsic(geometry, 'vertexgroups'); 9 | } 10 | 11 | string[] 12 | avl_vertexgroups(const string geometry) 13 | { 14 | return detailintrinsic(geometry, 'vertexgroups'); 15 | } 16 | 17 | #endif // _AVL_VERTEXGROUPS_H_ 18 | -------------------------------------------------------------------------------- /help/vex/functions/avl_print.txt: -------------------------------------------------------------------------------- 1 | = avl_print = 2 | 3 | #type: vex 4 | #context: all 5 | #tags: string, utility, print, avl 6 | #group: utility 7 | 8 | """Simply prints a single value of any type.""" 9 | 10 | :usage: `void avl_print( value)` 11 | :usage: `void avl_print( value[])` 12 | 13 | [Include:_common#geometry] 14 | 15 | :arg:value: 16 | Value to print. 17 | 18 | [Include:_avl_common#not_std] 19 | -------------------------------------------------------------------------------- /vex/include/avl_isclosed.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_ISCLOSED_H_ 3 | #define _AVL_ISCLOSED_H_ 4 | 5 | int 6 | avl_isclosed(const int geometry; const int primnum) 7 | { 8 | return primintrinsic(geometry, 'closed', primnum); 9 | } 10 | 11 | int 12 | avl_isclosed(const string geometry; const int primnum) 13 | { 14 | return primintrinsic(geometry, 'closed', primnum); 15 | } 16 | 17 | #endif // _AVL_ISCLOSED_H_ 18 | -------------------------------------------------------------------------------- /vex/include/avl_pointattribs.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_POINTATTRIBS_H_ 3 | #define _AVL_POINTATTRIBS_H_ 4 | 5 | string[] 6 | avl_pointattribs(const int geometry) 7 | { 8 | return detailintrinsic(geometry, 'pointattributes'); 9 | } 10 | 11 | string[] 12 | avl_pointattribs(const string geometry) 13 | { 14 | return detailintrinsic(geometry, 'pointattributes'); 15 | } 16 | 17 | #endif // _AVL_POINTATTRIBS_H_ 18 | -------------------------------------------------------------------------------- /vex/include/avl_primattribs.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_PRIMATTRIBS_H_ 3 | #define _AVL_PRIMATTRIBS_H_ 4 | 5 | string[] 6 | avl_primattribs(const int geometry) 7 | { 8 | return detailintrinsic(geometry, 'primitiveattributes'); 9 | } 10 | 11 | string[] 12 | avl_primattribs(const string geometry) 13 | { 14 | return detailintrinsic(geometry, 'primitiveattributes'); 15 | } 16 | 17 | #endif // _AVL_PRIMATTRIBS_H_ 18 | -------------------------------------------------------------------------------- /vex/include/avl_detailattribs.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_DETAILATTRIBS_H_ 3 | #define _AVL_DETAILATTRIBS_H_ 4 | 5 | string[] 6 | avl_detailattribs(const int geometry) 7 | { 8 | return detailintrinsic(geometry, 'detailattributes'); 9 | } 10 | 11 | string[] 12 | avl_detailattribs(const string geometry) 13 | { 14 | return detailintrinsic(geometry, 'detailattributes'); 15 | } 16 | 17 | #endif // _AVL_DETAILATTRIBS_H_ 18 | -------------------------------------------------------------------------------- /vex/include/avl_vertexattribs.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_VERTEXATTRIBS_H_ 3 | #define _AVL_VERTEXATTRIBS_H_ 4 | 5 | string[] 6 | avl_vertexattribs(const int geometry) 7 | { 8 | return detailintrinsic(geometry, 'vertexattributes'); 9 | } 10 | 11 | string[] 12 | avl_vertexattribs(const string geometry) 13 | { 14 | return detailintrinsic(geometry, 'vertexattributes'); 15 | } 16 | 17 | #endif // _AVL_VERTEXATTRIBS_H_ 18 | -------------------------------------------------------------------------------- /vex/include/avl_primarea.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_PRIMAREA_H_ 3 | #define _AVL_PRIMAREA_H_ 4 | 5 | float 6 | avl_primarea(const int geometry; const int primnum) 7 | { 8 | return primintrinsic(geometry, 'measuredarea', primnum); 9 | } 10 | 11 | float 12 | avl_primarea(const string geometry; const int primnum) 13 | { 14 | return primintrinsic(geometry, 'measuredarea', primnum); 15 | } 16 | 17 | #endif // _AVL_PRIMAREA_H_ 18 | -------------------------------------------------------------------------------- /vex/include/avl_frompolar.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_FROMPOLAR_H_ 3 | #define _AVL_FROMPOLAR_H_ 4 | 5 | vector2 6 | avl_frompolar(const float theta; const float radius) 7 | { 8 | float x = cos(theta); 9 | float y = sin(theta); 10 | return set(x, y) * radius; 11 | } 12 | 13 | vector2 14 | avl_frompolar(const vector2 position) 15 | { 16 | return avl_frompolar(position.u, position.v); 17 | } 18 | 19 | #endif // _AVL_FROMPOLAR_H_ 20 | -------------------------------------------------------------------------------- /vex/include/avl_triangulate.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_TRIANGULATE_H_ 3 | #define _AVL_TRIANGULATE_H_ 4 | 5 | int[] 6 | avl_triangulate(const int geohandle; const int primnum) 7 | { 8 | // 9 | } 10 | 11 | // Todo (1.0): int[] avl_triangulate(...; int start) 12 | 13 | // Todo (1.0): int[] avl_triangulate(...; string mode) 14 | 15 | // Todo (1.0): int[] avl_triangulate(...; string mode; int start) 16 | 17 | #endif // _AVL_TRIANGULATE_H_ 18 | -------------------------------------------------------------------------------- /vex/include/avl_primtypename.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_PRIMTYPENAME_H_ 3 | #define _AVL_PRIMTYPENAME_H_ 4 | 5 | string 6 | avl_primtypename(const int geometry; const int primnum) 7 | { 8 | return primintrinsic(geometry, 'typename', primnum); 9 | } 10 | 11 | string 12 | avl_primtypename(const string geometry; const int primnum) 13 | { 14 | return primintrinsic(geometry, 'typename', primnum); 15 | } 16 | 17 | #endif // _AVL_PRIMTYPENAME_H_ 18 | -------------------------------------------------------------------------------- /vex/include/avl_primvolume.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_PRIMVOLUME_H_ 3 | #define _AVL_PRIMVOLUME_H_ 4 | 5 | float 6 | avl_primvolume(const int geometry; const int primnum) 7 | { 8 | return primintrinsic(geometry, 'measuredvolume', primnum); 9 | } 10 | 11 | float 12 | avl_primvolume(const string geometry; const int primnum) 13 | { 14 | return primintrinsic(geometry, 'measuredvolume', primnum); 15 | } 16 | 17 | #endif // _AVL_PRIMVOLUME_H_ 18 | -------------------------------------------------------------------------------- /help/vex/functions/avl_primarea.txt: -------------------------------------------------------------------------------- 1 | = avl_primarea = 2 | 3 | #type: vex 4 | #context: all 5 | #tags: measure, avl 6 | #group: measure 7 | 8 | """Returns the area of the primitive.""" 9 | 10 | :usage: `float avl_primarea(, int primnum)` 11 | 12 | [Include:_common#geometry] 13 | 14 | :arg:primnum: 15 | The primitive number to read the area on. 16 | 17 | :returns: 18 | Returns the area of the primitive. 19 | 20 | [Include:_avl_common#not_std] 21 | -------------------------------------------------------------------------------- /vex/include/avl_hedge_dstpos.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_HEDGE_DSTPOS_H_ 3 | #define _AVL_HEDGE_DSTPOS_H_ 4 | 5 | float 6 | avl_hedge_dstpos(const int geometry; const int hedge) 7 | { 8 | return point(geometry, 'P', hedge_dstpoint(geometry, hedge)); 9 | } 10 | 11 | float 12 | avl_hedge_dstpos(const string geometry; const int hedge) 13 | { 14 | return point(geometry, 'P', hedge_dstpoint(geometry, hedge)); 15 | } 16 | 17 | #endif // _AVL_HEDGE_DSTPOS_H_ 18 | -------------------------------------------------------------------------------- /vex/include/avl_hedge_srcpos.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_HEDGE_SRCPOS_H_ 3 | #define _AVL_HEDGE_SRCPOS_H_ 4 | 5 | float 6 | avl_hedge_srcpos(const int geometry; const int hedge) 7 | { 8 | return point(geometry, 'P', hedge_srcpoint(geometry, hedge)); 9 | } 10 | 11 | float 12 | avl_hedge_srcpos(const string geometry; const int hedge) 13 | { 14 | return point(geometry, 'P', hedge_srcpoint(geometry, hedge)); 15 | } 16 | 17 | #endif // _AVL_HEDGE_SRCPOS_H_ 18 | -------------------------------------------------------------------------------- /vex/include/avl_limits.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_LIMITS_H_ 3 | #define _AVL_LIMITS_H_ 4 | 5 | #define AVL_INT32_MIN -2_147_483_648 6 | #define AVL_INT32_MAX 2_147_483_647 7 | 8 | #define AVL_INT64_MIN -9_223_372_036_854_775_808 9 | #define AVL_INT64_MAX 9_223_372_036_854_775_807 10 | 11 | #define AVL_FLOAT32_MIN -340282346638528859811704183484516925440.0 12 | #define AVL_FLOAT32_MAX 340282346638528859811704183484516925440.0 13 | 14 | #endif // _AVL_LIMITS_H_ 15 | -------------------------------------------------------------------------------- /help/vex/functions/avl_primvolume.txt: -------------------------------------------------------------------------------- 1 | = avl_primvolume = 2 | 3 | #type: vex 4 | #context: all 5 | #tags: measure, avl 6 | #group: measure 7 | 8 | """Returns the volume of the primitive.""" 9 | 10 | :usage: `float avl_primvolume(, int primnum)` 11 | 12 | [Include:_common#geometry] 13 | 14 | :arg:primnum: 15 | The primitive number to read the volume on. 16 | 17 | :returns: 18 | Returns the volume of the primitive. 19 | 20 | [Include:_avl_common#not_std] 21 | -------------------------------------------------------------------------------- /vex/include/avl_primperimeter.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_PRIMPERIMETER_H_ 3 | #define _AVL_PRIMPERIMETER_H_ 4 | 5 | float 6 | avl_primperimeter(const int geometry; const int primnum) 7 | { 8 | return primintrinsic(geometry, 'measuredperimeter', primnum); 9 | } 10 | 11 | float 12 | avl_primperimeter(const string geometry; const int primnum) 13 | { 14 | return primintrinsic(geometry, 'measuredperimeter', primnum); 15 | } 16 | 17 | #endif // _AVL_PRIMPERIMETER_H_ 18 | -------------------------------------------------------------------------------- /help/vex/functions/avl_unique.txt: -------------------------------------------------------------------------------- 1 | = avl_unique = 2 | 3 | #type: vex 4 | #context: all 5 | #tags: array, avl 6 | #group: array 7 | 8 | """Removes all but first element from every consecutive group of equivalent elements in an array.""" 9 | 10 | :usage: `[] avl_unique( sequence[])` 11 | 12 | :arg:sequence: 13 | Array with values. 14 | 15 | :returns: 16 | Returns the new array without successive repetitions of elements. 17 | 18 | [Include:_avl_common#not_std] 19 | -------------------------------------------------------------------------------- /vex/include/avl_incircle.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_INCIRCLE_H_ 3 | #define _AVL_INCIRCLE_H_ 4 | 5 | int 6 | avl_incircle(const vector2 position; const float radius) 7 | { 8 | return length2(position) <= radius * radius; 9 | } 10 | 11 | int 12 | avl_incircle(const vector2 position; 13 | const vector2 center; 14 | const float radius) 15 | { 16 | return distance2(position, center) <= radius * radius; 17 | } 18 | 19 | #endif // _AVL_INCIRCLE_H_ 20 | -------------------------------------------------------------------------------- /vex/include/avl_insphere.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_INSPHERE_H_ 3 | #define _AVL_INSPHERE_H_ 4 | 5 | int 6 | avl_insphere(const vector position; const float radius) 7 | { 8 | return length2(position) <= radius * radius; 9 | } 10 | 11 | int 12 | avl_insphere(const vector position; 13 | const vector center; 14 | const float radius) 15 | { 16 | return distance2(position, center) <= radius * radius; 17 | } 18 | 19 | #endif // _AVL_INSPHERE_H_ 20 | -------------------------------------------------------------------------------- /vex/include/avl_polysplit.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_POLYSPLIT_H_ 3 | #define _AVL_POLYSPLIT_H_ 4 | 5 | void 6 | avl_polysplit(const int geohandle; const int primnum) 7 | { 8 | int points[] = primpoints(geohandle, primnum); 9 | int newPoint; 10 | foreach (int vtxnum; int point; points) 11 | { 12 | newPoint = addpoint(geohandle, point); 13 | setvertexpoint(geohandle, primnum, vtxnum, newPoint); 14 | } 15 | } 16 | 17 | #endif // _AVL_POLYSPLIT_H_ 18 | -------------------------------------------------------------------------------- /help/vex/functions/avl_primperimeter.txt: -------------------------------------------------------------------------------- 1 | = avl_primperimeter = 2 | 3 | #type: vex 4 | #context: all 5 | #tags: measure, avl 6 | #group: measure 7 | 8 | """Returns the perimeter of the primitive.""" 9 | 10 | :usage: `float avl_primperimeter(, int primnum)` 11 | 12 | [Include:_common#geometry] 13 | 14 | :arg:primnum: 15 | The primitive number to read the perimeter on. 16 | 17 | :returns: 18 | Returns the perimeter of the primitive. 19 | 20 | [Include:_avl_common#not_std] 21 | -------------------------------------------------------------------------------- /vex/include/avl_hedge_presrcpos.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_HEDGE_PRESRCPOS_H_ 3 | #define _AVL_HEDGE_PRESRCPOS_H_ 4 | 5 | float 6 | avl_hedge_presrcpos(const int geometry; const int hedge) 7 | { 8 | return point(geometry, 'P', hedge_presrcpoint(geometry, hedge)); 9 | } 10 | 11 | float 12 | avl_hedge_presrcpos(const string geometry; const int hedge) 13 | { 14 | return point(geometry, 'P', hedge_presrcpoint(geometry, hedge)); 15 | } 16 | 17 | #endif // _AVL_HEDGE_PRESRCPOS_H_ 18 | -------------------------------------------------------------------------------- /vex/include/avl_hedge_postdstpos.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_HEDGE_POSTDSTPOS_H_ 3 | #define _AVL_HEDGE_POSTDSTPOS_H_ 4 | 5 | float 6 | avl_hedge_postdstpos(const int geometry; const int hedge) 7 | { 8 | return point(geometry, 'P', hedge_postdstpoint(geometry, hedge)); 9 | } 10 | 11 | float 12 | avl_hedge_postdstpos(const string geometry; const int hedge) 13 | { 14 | return point(geometry, 'P', hedge_postdstpoint(geometry, hedge)); 15 | } 16 | 17 | #endif // _AVL_HEDGE_POSTDSTPOS_H_ 18 | -------------------------------------------------------------------------------- /help/vex/functions/avl_inside.txt: -------------------------------------------------------------------------------- 1 | = avl_inside = 2 | 3 | #type: vex 4 | #context: all 5 | #tags: measure, proximity, avl 6 | #group: geo 7 | 8 | """Checks if the given position is inside the given geometry.""" 9 | 10 | :usage: `int avl_inside(, vector position)` 11 | 12 | [Include:_common#geometry] 13 | 14 | :arg:position: 15 | Position to check. 16 | 17 | :returns: 18 | Returns 1 if the `position` is inside a `geometry` or 0 otherwise. 19 | 20 | [Include:_avl_common#not_std] 21 | -------------------------------------------------------------------------------- /help/vex/functions/avl_padzero.txt: -------------------------------------------------------------------------------- 1 | = avl_padzero = 2 | 3 | #type: vex 4 | #context: all 5 | #tags: string, avl 6 | #group: string 7 | 8 | """Pads a value with zeros to make up given length.""" 9 | 10 | :usage: `string avl_padzero(int value, int size)` 11 | 12 | :arg:value: 13 | Integer value. 14 | 15 | :arg:size: 16 | Target length. 17 | 18 | :returns: 19 | Returns a string containing `value` preceded by enough zeros to make up `size` digits. 20 | 21 | [Include:_avl_common#not_std] 22 | -------------------------------------------------------------------------------- /help/vex/functions/avl_trianglenormal.txt: -------------------------------------------------------------------------------- 1 | = avl_trianglenormal = 2 | 3 | #type: vex 4 | #context: all 5 | #tags: math, avl 6 | #group: math 7 | 8 | """Calculates the normal of a triangle.""" 9 | 10 | :usage: `vector avl_trianglenormal(vector vertex1, vector vertex2, vector vertex3)` 11 | :usage: `vector avl_trianglenormal(vector vertices[])` 12 | 13 | :returns: 14 | Returns the normal vector of a triangle defined by three vertices. Normal is normalized. 15 | 16 | [Include:_avl_common#not_std] 17 | -------------------------------------------------------------------------------- /vex/include/avl_pointnormal.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_POINTNORMAL_H_ 3 | #define _AVL_POINTNORMAL_H_ 4 | 5 | #include "avl_primnormal.h" 6 | 7 | vector 8 | avl_pointnormal(int geometry; int ptnum) 9 | { 10 | vector normal = {0, 0, 0}; 11 | int primitives[] = pointprims(geometry, ptnum); 12 | for (int primitive : primitives) 13 | normal += avl_primnormal(geometry, primitive); 14 | return normalize(normal / len(primitives)); 15 | } 16 | 17 | #endif // _AVL_POINTNORMAL_H_ 18 | -------------------------------------------------------------------------------- /help/vex/functions/avl_maxindex.txt: -------------------------------------------------------------------------------- 1 | = avl_maxindex = 2 | 3 | #type: vex 4 | #context: all 5 | #tags: array, avl 6 | #group: array 7 | 8 | """Finds index of the maximum value in the array.""" 9 | 10 | :usage: `int avl_maxindex(int sequence[])` 11 | :usage: `int avl_maxindex(float sequence[])` 12 | 13 | :arg:sequence: 14 | Array with numeric values. 15 | 16 | :returns: 17 | Returns index of the maximum value in the array. 18 | 19 | [Include:_avl_common#not_std] 20 | 21 | @related 22 | 23 | - [Vex:avl_minindex] 24 | -------------------------------------------------------------------------------- /help/vex/functions/avl_minindex.txt: -------------------------------------------------------------------------------- 1 | = avl_minindex = 2 | 3 | #type: vex 4 | #context: all 5 | #tags: array, avl 6 | #group: array 7 | 8 | """Finds index of the minimum value in the array.""" 9 | 10 | :usage: `int avl_minindex(int sequence[])` 11 | :usage: `int avl_minindex(float sequence[])` 12 | 13 | :arg:sequence: 14 | Array with numeric values. 15 | 16 | :returns: 17 | Returns index of the minimum value in the array. 18 | 19 | [Include:_avl_common#not_std] 20 | 21 | @related 22 | 23 | - [Vex:avl_maxindex] 24 | -------------------------------------------------------------------------------- /vex/include/avl_topolar.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_TOPOLAR_H_ 3 | #define _AVL_TOPOLAR_H_ 4 | 5 | vector2 6 | avl_topolar(const float x; const float y;) 7 | { 8 | float theta = atan(y, x); 9 | float radius = length(set(x, y)); 10 | return set(theta, radius); 11 | } 12 | 13 | vector2 14 | avl_topolar(const vector2 position) 15 | { 16 | float theta = atan(position.y, position.x); 17 | float radius = length(position); 18 | return set(theta, radius); 19 | } 20 | 21 | #endif // _AVL_TOPOLAR_H_ 22 | -------------------------------------------------------------------------------- /help/vex/functions/avl_swap.txt: -------------------------------------------------------------------------------- 1 | = avl_swap = 2 | 3 | #type: vex 4 | #context: all 5 | #tags: utility, avl 6 | #group: utility 7 | 8 | """Exchanges the values of two variables.""" 9 | 10 | :usage: `void avl_swap( &variable1, &variable2)` 11 | :usage: `void avl_swap([] &variable1, [] &variable2)` 12 | 13 | Exchanges the values of `variable1` and `variable2`. 14 | 15 | :arg:variable1: 16 | First variable. 17 | 18 | :arg:variable2: 19 | Second variable. 20 | 21 | [Include:_avl_common#not_std] 22 | -------------------------------------------------------------------------------- /help/vex/functions/avl_angle.txt: -------------------------------------------------------------------------------- 1 | = avl_angle = 2 | 3 | #type: vex 4 | #context: all 5 | #tags: vector, avl 6 | #group: math 7 | 8 | """Returns the angle formed between the two vectors.""" 9 | 10 | :usage: `float avl_angle(vector2 vec1, vector2 vec2)` 11 | :usage: `float avl_angle(vector vec1, vector vec2)` 12 | 13 | :arg:vec1: 14 | First vector. 15 | 16 | :arg:vec2: 17 | Second vector. 18 | 19 | :returns: 20 | Returns the angle formed between the two vectors `vec1` and `vec2`. 21 | 22 | [Include:_avl_common#not_std] 23 | -------------------------------------------------------------------------------- /vex/include/avl_colors.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_COLORS_H_ 3 | #define _AVL_COLORS_H_ 4 | 5 | #define AVL_BLACK {0, 0, 0} 6 | #define AVL_WHITE {1, 1, 1} 7 | 8 | #define AVL_GREY(INTENSITY) {INTENSITY, INTENSITY, INTENSITY} 9 | #define AVL_GRAY(INTENSITY) {INTENSITY, INTENSITY, INTENSITY} 10 | 11 | #define AVL_RED {1, 0, 0} 12 | #define AVL_GREEN {0, 1, 0} 13 | #define AVL_BLUE {0, 0, 1} 14 | 15 | #define AVL_CYAN {0, 1, 1} 16 | #define AVL_MAGENTA {1, 0, 1} 17 | #define AVL_YELLOW {1, 1, 0} 18 | 19 | #endif // _AVL_COLORS_H_ 20 | -------------------------------------------------------------------------------- /help/vex/functions/_avl_common.txt: -------------------------------------------------------------------------------- 1 | #type: include 2 | 3 | :warning: 4 | #id: not_std 5 | 6 | Please note that this function is not included in the standard Houdini VEX library, but is part of the [Advanced VEX Library|/vex/avl]. 7 | 8 | :warning: 9 | #id: experimental 10 | 11 | This feature is experimental and subject to change in the future. 12 | 13 | :warning: 14 | #id: deprecated 15 | 16 | This feature was deprecated! 17 | 18 | :arg:geohandle: 19 | #id: geohandle 20 | 21 | Todo (1.0) 22 | -------------------------------------------------------------------------------- /vex/include/avl_splitext.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_SPLITEXT_H_ 3 | #define _AVL_SPLITEXT_H_ 4 | 5 | string 6 | avl_splitext(const string filename) 7 | { 8 | int fileNameLength = len(filename); 9 | if (fileNameLength < 2) // Empty or too short filename 10 | return ''; 11 | for (int i = --fileNameLength; i >= 0; --i) 12 | { 13 | if (filename[i] == '.') 14 | return filename[++i:]; 15 | if (filename[i] == '/' || filename[i] == '\\') 16 | return ''; 17 | } 18 | return ''; 19 | } 20 | 21 | #endif // _AVL_SPLITEXT_H_ 22 | -------------------------------------------------------------------------------- /vex/include/avl_mode.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_MODE_H_ 3 | #define _AVL_MODE_H_ 4 | 5 | #include "avl_unique.h" 6 | #include "avl_count.h" 7 | #include "avl_maxindex.h" 8 | 9 | int 10 | avl_mode(const int sequence[]) 11 | { 12 | int sequenceLength = len(sequence); 13 | int uniqueItems[] = avl_unique(sort(sequence)); 14 | int counts[]; 15 | resize(counts, len(uniqueItems)); 16 | foreach (int index; int value; uniqueItems) 17 | counts[index] = avl_count(sequence, value); 18 | return uniqueItems[avl_maxindex(counts)]; 19 | } 20 | 21 | #endif // _AVL_MODE_H_ 22 | -------------------------------------------------------------------------------- /help/vex/functions/avl_hedge_srcpos.txt: -------------------------------------------------------------------------------- 1 | = avl_hedge_srcpos = 2 | 3 | #type: vex 4 | #context: all 5 | #tags: hedge, avl 6 | #group: hedge 7 | 8 | """Returns the position of the source point of the half-edge.""" 9 | 10 | :usage: `vector avl_hedge_srcpos(, int hedge)` 11 | 12 | [Include:_common#geometry] 13 | 14 | :arg:hedge: 15 | Input half-edge. 16 | 17 | :returns: 18 | Returns the position of the source point of the `hedge`. 19 | 20 | 21 | [Include:_avl_common#not_std] 22 | 23 | @related 24 | 25 | - [Vex:avl_hedge_dstpos] 26 | -------------------------------------------------------------------------------- /help/vex/functions/avl_hedge_dstpos.txt: -------------------------------------------------------------------------------- 1 | = avl_hedge_dstpos = 2 | 3 | #type: vex 4 | #context: all 5 | #tags: hedge, avl 6 | #group: hedge 7 | 8 | """Returns the position of the destination point of the half-edge.""" 9 | 10 | :usage: `vector avl_hedge_dstpos(, int hedge)` 11 | 12 | [Include:_common#geometry] 13 | 14 | :arg:hedge: 15 | Input half-edge. 16 | 17 | :returns: 18 | Returns the position of the destination point of the `hedge`. 19 | 20 | 21 | [Include:_avl_common#not_std] 22 | 23 | @related 24 | 25 | - [Vex:avl_hedge_srcpos] 26 | -------------------------------------------------------------------------------- /vex/include/avl_angle.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_ANGLE_H_ 3 | #define _AVL_ANGLE_H_ 4 | 5 | float 6 | avl_angle(const vector2 vec1; const vector2 vec2) 7 | { 8 | return acos(dot(vec1, vec2) / sqrt(length2(vec1) * length2(vec2))); 9 | } 10 | 11 | // Todo (1.1): float avl_angle(const vector2; const vector2; const string mode) 12 | 13 | float 14 | avl_angle(const vector vec1; const vector vec2) 15 | { 16 | return acos(dot(vec1, vec2) / sqrt(length2(vec1) * length2(vec2))); 17 | } 18 | 19 | // Todo (1.1): float avl_angle(const vector; const vector; const string mode) 20 | 21 | #endif // _AVL_ANGLE_H_ 22 | -------------------------------------------------------------------------------- /help/vex/functions/avl_hedge_presrcpos.txt: -------------------------------------------------------------------------------- 1 | = avl_hedge_presrcpos = 2 | 3 | #type: vex 4 | #context: all 5 | #tags: hedge, avl 6 | #group: hedge 7 | 8 | """Returns the position of the pre-source point of the half-edge.""" 9 | 10 | :usage: `vector avl_hedge_presrcpos(, int hedge)` 11 | 12 | [Include:_common#geometry] 13 | 14 | :arg:hedge: 15 | Input half-edge. 16 | 17 | :returns: 18 | Returns the position of the pre-source point of the `hedge`. 19 | 20 | 21 | [Include:_avl_common#not_std] 22 | 23 | @related 24 | 25 | - [Vex:avl_hedge_postdstpos] 26 | -------------------------------------------------------------------------------- /help/vex/functions/avl_insphere.txt: -------------------------------------------------------------------------------- 1 | = avl_insphere = 2 | 3 | #type: vex 4 | #context: all 5 | #tags: measure, proximity, avl 6 | #group: geo 7 | 8 | """Checks if the given position is inside the given sphere.""" 9 | 10 | :usage: `int avl_insphere(vector position, vector center, float radius)` 11 | 12 | :arg:position: 13 | Position to check. 14 | 15 | :arg:center: 16 | Center of the given sphere. 17 | 18 | :arg:radius: 19 | Radius of the given sphere. 20 | 21 | :returns: 22 | Returns 1 if the `position` is inside a sphere with given `center` and `radius` or 0 otherwise. 23 | 24 | [Include:_avl_common#not_std] 25 | -------------------------------------------------------------------------------- /help/vex/functions/avl_count.txt: -------------------------------------------------------------------------------- 1 | = avl_count = 2 | 3 | #type: vex 4 | #context: all 5 | #tags: array, string, avl 6 | #group: array 7 | 8 | """Counts the number of times a value appears in an array or string.""" 9 | 10 | :usage: `int avl_count(string haystack, string needle)` 11 | :usage: `int avl_count( haystack[], needle)` 12 | 13 | :arg:haystack: 14 | String or array with items. 15 | 16 | :arg:needle: 17 | Value to count. 18 | 19 | :returns: 20 | Returns a number of all occurrences of a `needle` within a `haystack`. 21 | 22 | [Include:_avl_common#not_std] 23 | 24 | @related 25 | 26 | - [Vex:find] 27 | -------------------------------------------------------------------------------- /help/vex/functions/avl_hedge_postdstpos.txt: -------------------------------------------------------------------------------- 1 | = avl_hedge_postdstpos = 2 | 3 | #type: vex 4 | #context: all 5 | #tags: hedge, avl 6 | #group: hedge 7 | 8 | """Returns the position of the post-destination point of the half-edge.""" 9 | 10 | :usage: `vector avl_hedge_postdstpos(, int hedge)` 11 | 12 | [Include:_common#geometry] 13 | 14 | :arg:hedge: 15 | Input half-edge. 16 | 17 | :returns: 18 | Returns the position of the post-destination point of the `hedge`. 19 | 20 | 21 | [Include:_avl_common#not_std] 22 | 23 | @related 24 | 25 | - [Vex:avl_hedge_presrcpos] 26 | -------------------------------------------------------------------------------- /help/vex/functions/avl_medianlow.txt: -------------------------------------------------------------------------------- 1 | = avl_medianlow = 2 | 3 | #type: vex 4 | #context: all 5 | #tags: array, math, avl 6 | #group: array 7 | 8 | """Returns the low median (middle value) of numeric data.""" 9 | 10 | :usage: `int avl_medianlow(int sequence[])` 11 | :usage: `float avl_medianlow(float sequence[])` 12 | 13 | :arg:sequence: 14 | Array with numeric values. 15 | 16 | :returns: 17 | Returns the middle value, when the sequence length is odd. Returns the smaller of the two middle values, when it is even. 18 | 19 | [Include:_avl_common#not_std] 20 | 21 | @related 22 | 23 | - [Vex:avl_median] 24 | - [Vex:avl_medianhigh] 25 | -------------------------------------------------------------------------------- /help/vex/functions/avl_medianhigh.txt: -------------------------------------------------------------------------------- 1 | = avl_medianhigh = 2 | 3 | #type: vex 4 | #context: all 5 | #tags: array, math, avl 6 | #group: array 7 | 8 | """Returns the high median (middle value) of numeric data.""" 9 | 10 | :usage: `int avl_medianhigh(int sequence[])` 11 | :usage: `float avl_medianhigh(float sequence[])` 12 | 13 | :arg:sequence: 14 | Array with numeric values. 15 | 16 | :returns: 17 | Returns the middle value, when the sequence length is odd. Returns the larger of the two middle values, when it is even. 18 | 19 | [Include:_avl_common#not_std] 20 | 21 | @related 22 | 23 | - [Vex:avl_median] 24 | - [Vex:avl_medianlow] 25 | -------------------------------------------------------------------------------- /help/vex/functions/avl_median.txt: -------------------------------------------------------------------------------- 1 | = avl_median = 2 | 3 | #type: vex 4 | #context: all 5 | #tags: array, math, avl 6 | #group: array 7 | 8 | """Returns the median (middle value) of numeric data, using the common "mean of middle two" method.""" 9 | 10 | :usage: `float avl_median(int sequence[])` 11 | :usage: `float avl_median(float sequence[])` 12 | 13 | :arg:sequence: 14 | Array with numeric values. 15 | 16 | :returns: 17 | Returns the median (middle value) of numeric data, using the common "mean of middle two" method. 18 | 19 | [Include:_avl_common#not_std] 20 | 21 | @related 22 | 23 | - [Vex:avl_medianhigh] 24 | - [Vex:avl_medianlow] 25 | -------------------------------------------------------------------------------- /help/vex/functions/avl_trianglearea.txt: -------------------------------------------------------------------------------- 1 | = avl_trianglearea = 2 | 3 | #type: vex 4 | #context: all 5 | #tags: math, avl 6 | #group: math 7 | 8 | """Calculates the area of a triangle.""" 9 | 10 | :usage: `float avl_trianglearea(vector2 vertex1, vector2 vertex2, vector2 vertex3)` 11 | :usage: `float avl_trianglearea(vector2 vertices[])` 12 | :usage: `float avl_trianglearea(vector vertex1, vector vertex2, vector vertex3)` 13 | :usage: `float avl_trianglearea(vector vertices[])` 14 | 15 | :returns: 16 | Returns the area of a triangle defined by three vertices. 17 | 18 | [Include:_avl_common#not_std] 19 | 20 | @related 21 | 22 | - [Vex:avl_polyarea] 23 | -------------------------------------------------------------------------------- /vex/include/avl_reversevertexorder.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_REVERSEVERTEXORDER_H_ 3 | #define _AVL_REVERSEVERTEXORDER_H_ 4 | 5 | void 6 | avl_reversevertexorder(const int geometry; const int primnum) 7 | { 8 | int vertexCount = primvertexcount(geometry, primnum); 9 | int index; // Stores linear vertex index and point number 10 | for (int vtxnum = 0; vtxnum < vertexCount; ++vtxnum) 11 | { 12 | index = vertexindex(geometry, primnum, vertexCount - vtxnum); 13 | index = vertexpoint(geometry, index); 14 | setvertexpoint(geometry, primnum, vtxnum, index); 15 | } 16 | } 17 | 18 | #endif // _AVL_REVERSEVERTEXORDER_H_ 19 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/some-useful-function.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Some useful function 3 | about: Suggest a function for library 4 | 5 | --- 6 | 7 | **Is your feature request related to a problem? Please describe.** 8 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 9 | 10 | **Describe the solution you'd like** 11 | A clear and concise description of what you want to happen. 12 | 13 | **Describe alternatives you've considered** 14 | A clear and concise description of any alternative solutions or features you've considered. 15 | 16 | **Additional context** 17 | Add any other context or screenshots about the feature request here. 18 | -------------------------------------------------------------------------------- /vex/include/avl_inrect.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_INRECT_H_ 3 | #define _AVL_INRECT_H_ 4 | 5 | int 6 | avl_inrect(const vector2 min; 7 | const vector2 max; 8 | const vector2 position) 9 | { 10 | return position.x > min.x && position.x < max.x && 11 | position.y > min.y && position.y < max.y; 12 | } 13 | 14 | int 15 | avl_inrect(const float left; 16 | const float right; 17 | const float top; 18 | const float bottom; 19 | const vector2 position) 20 | { 21 | return position.x > left && position.x < right && 22 | position.y > bottom && position.y < top; 23 | } 24 | 25 | #endif // _AVL_INRECT_H_ 26 | -------------------------------------------------------------------------------- /help/vex/functions/avl_polyneighbours.txt: -------------------------------------------------------------------------------- 1 | = avl_polyneighbours = 2 | 3 | #type: vex 4 | #context: all 5 | #tags: prim, proximity, avl 6 | #group: geo 7 | 8 | """Returns an array of primitive numbers of polygons that share an edge or points with this polygon.""" 9 | 10 | :usage: `int[] avl_polyneighbours(, int primnum)` 11 | :usage: `int[] avl_polyneighbours(, int primnum, int byPoints)` 12 | 13 | [Include:_common#geometry] 14 | 15 | :arg:primnum: 16 | The primitive number. 17 | 18 | :arg:byPoints: 19 | <>. 20 | 21 | :returns: 22 | Returns an array of primitive numbers of polygons that share an edge or points with this polygon. 23 | 24 | [Include:_avl_common#not_std] 25 | -------------------------------------------------------------------------------- /vex/include/avl_removeduplicates.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_REMOVEDUPLICATES_H_ 3 | #define _AVL_REMOVEDUPLICATES_H_ 4 | 5 | string 6 | avl_removeduplicates(const string text; const string character) 7 | { 8 | string newText = text[0]; 9 | string current; 10 | for (int i = 1; i < len(text); ++i) 11 | { 12 | current = text[i]; 13 | if (current == character && text[i-1] == current) 14 | continue; 15 | else 16 | append(newText, current); 17 | } 18 | return newText; 19 | } 20 | 21 | string 22 | avl_removeduplicates(const string text) 23 | { 24 | return avl_removeduplicates(text, ' '); 25 | } 26 | 27 | #endif // _AVL_REMOVEDUPLICATES_H_ 28 | -------------------------------------------------------------------------------- /help/vex/functions/avl_clamp01.txt: -------------------------------------------------------------------------------- 1 | = avl_clamp01 = 2 | 3 | #type: vex 4 | #context: all 5 | #tags: interp, avl 6 | #group: interp 7 | 8 | """Returns value clamped between 0 and 1.""" 9 | 10 | :usage: `float clamp01(float value)` 11 | :usage: `vector2 clamp01(vector2 value)` 12 | :usage: `vector clamp01(vector value)` 13 | :usage: `vector4 clamp01(vector4 value)` 14 | 15 | :arg:value: 16 | Value to clamp. 17 | 18 | :returns: 19 | Returns <> clamped between `0` and `1`. For vectors, this is done per-component. 20 | 21 | [Include:_avl_common#not_std] 22 | 23 | @related 24 | 25 | - [Vex:clamp] 26 | - [Vex:avl_clamp11] 27 | - [Vex:fit] 28 | - [Vex:fit01] 29 | - [Vex:fit10] 30 | - [Vex:fit11] 31 | - [Vex:efit] 32 | -------------------------------------------------------------------------------- /help/vex/functions/avl_clamp11.txt: -------------------------------------------------------------------------------- 1 | = avl_clamp11 = 2 | 3 | #type: vex 4 | #context: all 5 | #tags: interp, avl 6 | #group: interp 7 | 8 | """Returns value clamped between -1 and 1.""" 9 | 10 | :usage: `float clamp11(float value)` 11 | :usage: `vector2 clamp11(vector2 value)` 12 | :usage: `vector clamp11(vector value)` 13 | :usage: `vector4 clamp11(vector4 value)` 14 | 15 | :arg:value: 16 | Value to clamp. 17 | 18 | :returns: 19 | Returns <> clamped between `-1` and `1`. For vectors, this is done per-component. 20 | 21 | [Include:_avl_common#not_std] 22 | 23 | @related 24 | 25 | - [Vex:clamp] 26 | - [Vex:avl_clamp01] 27 | - [Vex:fit] 28 | - [Vex:fit01] 29 | - [Vex:fit10] 30 | - [Vex:fit11] 31 | - [Vex:efit] 32 | -------------------------------------------------------------------------------- /vex/include/avl_shiftvertexorder.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_SHIFTVERTEXORDER_H_ 3 | #define _AVL_SHIFTVERTEXORDER_H_ 4 | 5 | void 6 | avl_shiftvertexorder(const int geometry; 7 | const int primnum; 8 | const int shift) 9 | { 10 | int vertexCount = primvertexcount(geometry, primnum); 11 | int index; // Stores linear vertex index and point number 12 | for (int vtxnum = 0; vtxnum < vertexCount; ++vtxnum) 13 | { 14 | index = vertexindex(geometry, primnum, (vtxnum - shift) % vertexCount); 15 | index = vertexpoint(geometry, index); 16 | setvertexpoint(geometry, primnum, vtxnum, index); 17 | } 18 | } 19 | 20 | #endif // _AVL_SHIFTVERTEXORDER_H_ 21 | -------------------------------------------------------------------------------- /help/vex/functions/avl_round.txt: -------------------------------------------------------------------------------- 1 | = avl_round = 2 | 3 | #type: vex 4 | #context: all 5 | #tags: avl, math, number 6 | #group: math 7 | 8 | """Rounds the number to the given precision.""" 9 | 10 | :usage: `int avl_round(int value, int ndigits)` 11 | :usage: `float avl_round(float value, int ndigits)` 12 | :usage: ` avl_round( value, int ndigits)` 13 | 14 | For vectors, this is done per-component. 15 | 16 | :usage: `[] avl_round( values[], int ndigits)` 17 | 18 | :arg:value(s): 19 | The value(s) to round. 20 | 21 | :arg:ndigits: 22 | Target precision. 23 | 24 | :returns: 25 | Returns the `value` rounded to `ndigits` precision before/after the decimal point. 26 | 27 | [Include:_avl_common#not_std] 28 | -------------------------------------------------------------------------------- /vex/include/avl_medianhigh.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_MEDIANHIGH_H_ 3 | #define _AVL_MEDIANHIGH_H_ 4 | 5 | float 6 | avl_medianhigh(const float sequence[]) 7 | { 8 | float sorted[] = sort(sequence); 9 | return sorted[len(sorted) / 2]; 10 | } 11 | 12 | int 13 | avl_medianhigh(const int sequence[]) 14 | { 15 | int sorted[] = sort(sequence); 16 | return sorted[len(sorted) / 2]; 17 | } 18 | 19 | // Todo (1.0): vector2 avl_medianhigh(const vector2[]) 20 | 21 | // Todo (1.0): vector avl_medianhigh(const vector[]) 22 | 23 | // Todo (2.0): float avl_medianhigh(const float; const float; const float ...) 24 | 25 | // Todo (2.0): int avl_medianhigh(const int; const int; const int ...) 26 | 27 | #endif // _AVL_MEDIANHIGH_H_ 28 | -------------------------------------------------------------------------------- /vex/include/avl_medianlow.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_MEDIANLOW_H_ 3 | #define _AVL_MEDIANLOW_H_ 4 | 5 | float 6 | avl_medianlow(const float sequence[]) 7 | { 8 | float sorted[] = sort(sequence); 9 | return sorted[(len(sorted) - 1) / 2]; 10 | } 11 | 12 | int 13 | avl_medianlow(const int sequence[]) 14 | { 15 | int sorted[] = sort(sequence); 16 | return sorted[(len(sorted) - 1) / 2]; 17 | } 18 | 19 | // Todo (1.0): vector2 avl_medianlow(const vector2[]) 20 | 21 | // Todo (1.0): vector avl_medianlow(const vector[]) 22 | 23 | // Todo (2.0): float avl_medianlow(const float; const float; const float ...) 24 | 25 | // Todo (2.0): int avl_medianlow(const int; const int; const int ...) 26 | 27 | #endif // _AVL_MEDIANLOW_H_ 28 | -------------------------------------------------------------------------------- /vex/include/avl_getbbox_volume.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_GETBBOX_VOLUME_H_ 3 | #define _AVL_GETBBOX_VOLUME_H_ 4 | 5 | float 6 | avl_getbbox_volume(const int geometry) 7 | { 8 | return product(vector(getbbox_size(geometry))); 9 | } 10 | 11 | float 12 | avl_getbbox_volume(const string geometry) 13 | { 14 | return product(vector(getbbox_size(geometry))); 15 | } 16 | 17 | float 18 | avl_getbbox_volume(const int geometry; const string primgroup) 19 | { 20 | return product(vector(getbbox_size(geometry, primgroup))); 21 | } 22 | 23 | float 24 | avl_getbbox_volume(const string geometry; const string primgroup) 25 | { 26 | return product(vector(getbbox_size(geometry, primgroup))); 27 | } 28 | 29 | #endif // _AVL_GETBBOX_VOLUME_H_ 30 | -------------------------------------------------------------------------------- /vex/include/avl_trinormal.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_TRINORMAL_H_ 3 | #define _AVL_TRINORMAL_H_ 4 | 5 | vector 6 | avl_trinormal(const vector vertex1; 7 | const vector vertex2; 8 | const vector vertex3) 9 | { 10 | vector edge1 = vertex1 - vertex2; 11 | vector edge2 = vertex3 - vertex2; 12 | return normalize(cross(edge1, edge2)); 13 | } 14 | 15 | vector 16 | avl_trinormal(const vector vertices[]) 17 | { 18 | // Todo (1.0): Triangle check 19 | vector edge1 = vertices[0] - vertices[1]; 20 | vector edge2 = vertices[2] - vertices[1]; 21 | return normalize(cross(edge1, edge2)); 22 | } 23 | 24 | // Todo (1.0): float avl_trinormal(; int point1; int point2; int point3) 25 | 26 | #endif // _AVL_TRINORMAL_H_ 27 | -------------------------------------------------------------------------------- /vex/include/avl_getpointbbox_volume.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_GETPOINTBBOX_VOLUME_H_ 3 | #define _AVL_GETPOINTBBOX_VOLUME_H_ 4 | 5 | float 6 | avl_getpointbbox_volume(const int geometry) 7 | { 8 | return product(vector(getpointbbox_size(geometry))); 9 | } 10 | 11 | float 12 | avl_getpointbbox_volume(const string geometry) 13 | { 14 | return product(vector(getpointbbox_size(geometry))); 15 | } 16 | 17 | float 18 | avl_getpointbbox_volume(const int geometry; const string pointgroup) 19 | { 20 | return product(vector(getpointbbox_size(geometry, pointgroup))); 21 | } 22 | 23 | float 24 | avl_getpointbbox_volume(const string geometry; const string pointgroup) 25 | { 26 | return product(vector(getpointbbox_size(geometry, pointgroup))); 27 | } 28 | 29 | #endif // _AVL_GETPOINTBBOX_VOLUME_H_ 30 | -------------------------------------------------------------------------------- /vex/include/avl_polyperimeter.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_POLYPERIMETER_H_ 3 | #define _AVL_POLYPERIMETER_H_ 4 | 5 | float 6 | avl_polyperimeter(const vector2 vertices[]) 7 | { 8 | float perimeter = 0; 9 | for (int v = len(vertices)-2; v >= -1; --v) 10 | perimeter += distance(vertices[v], vertices[v+1]); 11 | return perimeter; 12 | } 13 | 14 | // Todo (2.0): float avl_polyperimeter(const vector2 ...) 15 | 16 | float 17 | avl_polyperimeter(const vector vertices[]) 18 | { 19 | float perimeter = 0; 20 | for (int v = len(vertices)-2; v >= -1; --v) 21 | perimeter += distance(vertices[v], vertices[v+1]); 22 | return perimeter; 23 | } 24 | 25 | // Todo (1.0): float avl_polyperimeter(; const int points[]) 26 | 27 | // Todo (2.0): float avl_polyperimeter(const int ...) 28 | 29 | // Todo (2.0): float avl_polyperimeter(const vector ...) 30 | 31 | #endif // _AVL_POLYPERIMETER_H_ 32 | -------------------------------------------------------------------------------- /help/vex/functions/avl_normalizevalues.txt: -------------------------------------------------------------------------------- 1 | = avl_normalizevalues = 2 | 3 | #type: vex 4 | #context: all 5 | #tags: math, array, avl 6 | #group: math 7 | 8 | """Normalizes values to sum 1.""" 9 | 10 | :usage: ` avl_normalizevalues( values)` 11 | :usage: `float[] avl_normalizevalues(int values[])` 12 | :usage: `float[] avl_normalizevalues(float values[])` 13 | :usage: `float[] avl_normalizevalues(int values[], float scale)` 14 | :usage: `float[] avl_normalizevalues(float values[], float scale)` 15 | 16 | :arg:values: 17 | Array or vector with *positive* numeric values. 18 | 19 | :arg:scale: 20 | Multiplier for values. 21 | 22 | This is very efficient way to multiply array values after normalization. For vectors, just use multiplication. 23 | 24 | :returns: 25 | Returns a new array with `values` normalized to sum `1` multiplied by the `scale`. 26 | 27 | [Include:_avl_common#not_std] 28 | 29 | @related 30 | 31 | - [Vex:normalize] 32 | -------------------------------------------------------------------------------- /vex/include/avl_copypointgroup.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_COPYPOINTGROUP_H_ 3 | #define _AVL_COPYPOINTGROUP_H_ 4 | 5 | int 6 | avl_copypointgroup(const int geometry; 7 | const int geohandle; 8 | const int srcPtnum; 9 | const int dstPtnum; 10 | const string groupName) 11 | { 12 | int value = inpointgroup(geometry, groupName, srcPtnum); 13 | return setpointgroup(geohandle, groupName, dstPtnum, value); 14 | } 15 | 16 | int 17 | avl_copypointgroup(const int geometry; 18 | const int geohandle; 19 | const int srcPtnum; 20 | const int dstPtnum; 21 | const string groupName; 22 | const string mode) 23 | { 24 | int value = inpointgroup(geometry, groupName, srcPtnum); 25 | return setpointgroup(geohandle, groupName, dstPtnum, value, mode); 26 | } 27 | 28 | #endif // _AVL_COPYPOINTGROUP_H_ 29 | -------------------------------------------------------------------------------- /vex/include/avl_copyprimgroup.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_COPYPRIMGROUP_H_ 3 | #define _AVL_COPYPRIMGROUP_H_ 4 | 5 | int 6 | avl_copyprimgroup(const int geometry; 7 | const int geohandle; 8 | const int srcPrimnum; 9 | const int dstPrimnum; 10 | const string groupName) 11 | { 12 | int value = inprimgroup(geometry, groupName, srcPrimnum); 13 | return setprimgroup(geohandle, groupName, dstPrimnum, value); 14 | } 15 | 16 | int 17 | avl_copyprimgroup(const int geometry; 18 | const int geohandle; 19 | const int srcPrimnum; 20 | const int dstPrimnum; 21 | const string groupName; 22 | const string mode) 23 | { 24 | int value = inprimgroup(geometry, groupName, srcPrimnum); 25 | return setprimgroup(geohandle, groupName, dstPrimnum, value, mode); 26 | } 27 | 28 | #endif // _AVL_COPYPRIMGROUP_H_ 29 | -------------------------------------------------------------------------------- /PARMmenu.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /help/vex/functions/avl_removevertex.txt: -------------------------------------------------------------------------------- 1 | = avl_removevertex = 2 | 3 | #type: vex 4 | #context: all 5 | #tags: vertex, delete, avl 6 | #group: geo 7 | 8 | """Removes a vertex from the geometry.""" 9 | 10 | :usage: `void avl_removevertex(int geohandle, int vtxnum)` 11 | :usage: `void avl_removevertex(int geohandle, int primnum, int vtxnum)` 12 | :usage: `void avl_removevertex(int geohandle, int primnum, int vtxnum, int mode)` 13 | 14 | Removes a vertex in the geometry specified by `geohandle`. 15 | 16 | [Include:_avl_common#geohandle] 17 | 18 | :arg:primnum: 19 | Primitive number. 20 | 21 | :arg:vtxnum: 22 | Vertex number. 23 | 24 | If `primnum` is `-1`, `vtxnum` is treated as a linear index. Otherwise, the pair (`primnum`, `vtxnum`) is used to identify a vertex in a primitive’s vertex list. 25 | 26 | :arg:mode: 27 | Todo (1.0): 1 - remove signle point 28 | 29 | [Include:_avl_common#not_std] 30 | 31 | @related 32 | 33 | - [Vex:removepoint] 34 | - [Vex:removeprim] 35 | -------------------------------------------------------------------------------- /vex/include/avl_diff.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_DIFF_H_ 3 | #define _AVL_DIFF_H_ 4 | // Prototype 5 | void 6 | avl_diff(const string str1; const string str2) 7 | { 8 | int add[]; 9 | int remove[]; 10 | int index1 = 0; 11 | int index2 = 0; 12 | int str1Length = len(str1); 13 | int str2Length = len(str2); 14 | while (index1 < str1Length || index2 < str2Length) 15 | if (str1[index1] == str2[index2]) 16 | { 17 | printf('\ni1:%g(%g)\ni2:%g(%g)\n', 18 | index1, str1[index1], index2, str2[index2]); 19 | ++index1; 20 | ++index2; 21 | } else if (str1[index1] == '') 22 | { 23 | append(add, index2++); 24 | } else if (str2[index2] == '') 25 | { 26 | append(remove, index1++); 27 | } else 28 | { 29 | append(add, index2++); 30 | } 31 | printf('\nRemove:%g\nAdd:%g\n', remove, add); 32 | } 33 | 34 | #endif // _AVL_DIFF_H_ 35 | -------------------------------------------------------------------------------- /vex/include/avl_getbbox_area.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_GETBBOX_AREA_H_ 3 | #define _AVL_GETBBOX_AREA_H_ 4 | 5 | float 6 | avl_getbbox_area(const int geometry) 7 | { 8 | vector size = getbbox_size(geometry); 9 | return (size.x * size.y + size.y * size.z + size.x * size.z) * 2.0; 10 | } 11 | 12 | float 13 | avl_getbbox_area(const string geometry) 14 | { 15 | vector size = getbbox_size(geometry); 16 | return (size.x * size.y + size.y * size.z + size.x * size.z) * 2.0; 17 | } 18 | 19 | float 20 | avl_getbbox_area(const int geometry; const string primgroup) 21 | { 22 | vector size = getbbox_size(geometry, primgroup); 23 | return (size.x * size.y + size.y * size.z + size.x * size.z) * 2.0; 24 | } 25 | 26 | float 27 | avl_getbbox_area(const string geometry; const string primgroup) 28 | { 29 | vector size = getbbox_size(geometry, primgroup); 30 | return (size.x * size.y + size.y * size.z + size.x * size.z) * 2.0; 31 | } 32 | 33 | #endif // _AVL_GETBBOX_AREA_H_ 34 | -------------------------------------------------------------------------------- /vex/include/avl_copyvertexgroup.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_COPYVERTEXGROUP_H_ 3 | #define _AVL_COPYVERTEXGROUP_H_ 4 | 5 | int 6 | avl_copyvertexgroup(const int geometry; 7 | const int geohandle; 8 | const int srcVtxnum; 9 | const int dstVtxnum; 10 | const string groupName) 11 | { 12 | int value = invertexgroup(geometry, groupName, srcVtxnum); 13 | return setvertexgroup(geohandle, groupName, dstVtxnum, -1, value); 14 | } 15 | 16 | int 17 | avl_copyvertexgroup(const int geometry; 18 | const int geohandle; 19 | const int srcVtxnum; 20 | const int dstVtxnum; 21 | const string groupName; 22 | const string mode) 23 | { 24 | int value = invertexgroup(geometry, groupName, srcVtxnum); 25 | return setvertexgroup(geohandle, groupName, dstVtxnum, -1, value, mode); 26 | } 27 | 28 | #endif // _AVL_COPYVERTEXGROUP_H_ 29 | -------------------------------------------------------------------------------- /vex/include/avl_tricentroid.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_TRICENTROID_H_ 3 | #define _AVL_TRICENTROID_H_ 4 | 5 | vector2 6 | avl_tricentroid(const vector2 vertex1; 7 | const vector2 vertex2; 8 | const vector2 vertex3) 9 | { 10 | return (vertex1 + vertex2 + vertex3) / 3.0; 11 | } 12 | 13 | vector2 14 | avl_tricentroid(const vector2 vertices[]) 15 | { 16 | // Todo (1.0): Triangle check 17 | return (vertices[0] + vertices[1] + vertices[2]) / 3.0; 18 | } 19 | 20 | vector 21 | avl_tricentroid(const vector vertex1; 22 | const vector vertex2; 23 | const vector vertex3) 24 | { 25 | return (vertex1 + vertex2 + vertex3) / 3.0; 26 | } 27 | 28 | vector 29 | avl_tricentroid(const vector vertices[]) 30 | { 31 | // Todo (1.0): Triangle check 32 | return (vertices[0] + vertices[1] + vertices[2]) / 3.0; 33 | } 34 | 35 | // Todo (1.0): float avl_tricentroid(; int point1; int point2; int point3) 36 | 37 | #endif // _AVL_TRICENTROID_H_ 38 | -------------------------------------------------------------------------------- /vex/include/avl_getpointbbox_area.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_GETPOINTBBOX_AREA_H_ 3 | #define _AVL_GETPOINTBBOX_AREA_H_ 4 | 5 | float 6 | avl_getpointbbox_area(const int geometry) 7 | { 8 | vector size = getpointbbox_size(geometry); 9 | return (size.x * size.y + size.y * size.z + size.x * size.z) * 2.0; 10 | } 11 | 12 | float 13 | avl_getpointbbox_area(const string geometry) 14 | { 15 | vector size = getpointbbox_size(geometry); 16 | return (size.x * size.y + size.y * size.z + size.x * size.z) * 2.0; 17 | } 18 | 19 | float 20 | avl_getpointbbox_area(const int geometry; const string pointgroup) 21 | { 22 | vector size = getpointbbox_size(geometry, pointgroup); 23 | return (size.x * size.y + size.y * size.z + size.x * size.z) * 2.0; 24 | } 25 | 26 | float 27 | avl_getpointbbox_area(const string geometry; const string pointgroup) 28 | { 29 | vector size = getpointbbox_size(geometry, pointgroup); 30 | return (size.x * size.y + size.y * size.z + size.x * size.z) * 2.0; 31 | } 32 | 33 | #endif // _AVL_GETPOINTBBOX_AREA_H_ 34 | -------------------------------------------------------------------------------- /vex/include/avl_trivolume.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_TRIVOLUME_H_ 3 | #define _AVL_TRIVOLUME_H_ 4 | 5 | float 6 | avl_trivolume(const vector origin; 7 | const vector vertex1; 8 | const vector vertex2; 9 | const vector vertex3) 10 | { 11 | vector edge1 = origin - vertex1; 12 | vector edge2 = origin - vertex2; 13 | vector edge3 = origin - vertex3; 14 | return abs(determinant(set(edge1, edge2, edge3))) / 6.0; 15 | } 16 | 17 | float 18 | avl_trivolume(const vector origin; const vector vertices[]) 19 | { 20 | // Todo (1.0): Triangle check 21 | vector edge1 = origin - vertices[0]; 22 | vector edge2 = origin - vertices[1]; 23 | vector edge3 = origin - vertices[2]; 24 | return abs(determinant(set(edge1, edge2, edge3))) / 6.0; 25 | } 26 | 27 | // Todo (1.0): float avl_trivolume(; vector origin; int point1; int point2; int point3) 28 | 29 | // Todo (1.0): float avl_trivolume(; int origin; int point1; int point2; int point3) 30 | 31 | #endif // _AVL_TRIVOLUME_H_ 32 | -------------------------------------------------------------------------------- /vex/include/avl_inside.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_INSIDE_H_ 3 | #define _AVL_INSIDE_H_ 4 | 5 | int avl_inside(const int geometry; const vector position) 6 | { 7 | int primitive; 8 | vector uvw; 9 | xyzdist(geometry, position, primitive, uvw); 10 | vector hitPosition = primuv(geometry, 'P', primitive, uvw); 11 | vector normal = prim_normal(geometry, primitive, uvw); 12 | vector direction = normalize(hitPosition - position); 13 | if (dot(direction, normal) > 0) 14 | return 1; 15 | else 16 | return 0; 17 | } 18 | 19 | int avl_inside(const string geometry; const vector position) 20 | { 21 | int primitive; 22 | vector uvw; 23 | xyzdist(geometry, position, primitive, uvw); 24 | vector hitPosition = primuv(geometry, 'P', primitive, uvw); 25 | vector normal = prim_normal(geometry, primitive, uvw); 26 | vector direction = normalize(hitPosition - position); 27 | if (dot(direction, normal) > 0) 28 | return 1; 29 | else 30 | return 0; 31 | } 32 | 33 | #endif // _AVL_INSIDE_H_ 34 | -------------------------------------------------------------------------------- /vex/include/avl_maxindex.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_MAXINDEX_H_ 3 | #define _AVL_MAXINDEX_H_ 4 | 5 | // Todo (?): -1 for empty sequence 6 | 7 | int 8 | avl_maxindex(const float sequence[]) 9 | { 10 | int maxIndex = 0; 11 | float maxValue = sequence[maxIndex]; 12 | float currentValue; 13 | for (int i = 1; i < len(sequence); ++i) 14 | { 15 | currentValue = sequence[i]; 16 | if (currentValue > maxValue) 17 | { 18 | maxValue = currentValue; 19 | maxIndex = i; 20 | } 21 | } 22 | return maxIndex; 23 | } 24 | 25 | int 26 | avl_maxindex(const int sequence[]) 27 | { 28 | int maxIndex = 0; 29 | int maxValue = sequence[maxIndex]; 30 | int currentValue; 31 | for (int i = 1; i < len(sequence); ++i) 32 | { 33 | currentValue = sequence[i]; 34 | if (currentValue > maxValue) 35 | { 36 | maxValue = currentValue; 37 | maxIndex = i; 38 | } 39 | } 40 | return maxIndex; 41 | } 42 | 43 | #endif // _AVL_MAXINDEX_H_ 44 | -------------------------------------------------------------------------------- /vex/include/avl_minindex.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_MININDEX_H_ 3 | #define _AVL_MININDEX_H_ 4 | 5 | // Todo (?): -1 for empty sequence 6 | 7 | int 8 | avl_minindex(const float sequence[]) 9 | { 10 | int minIndex = 0; 11 | float minValue = sequence[minIndex]; 12 | float currentValue; 13 | for (int i = 1; i < len(sequence); ++i) 14 | { 15 | currentValue = sequence[i]; 16 | if (currentValue < minValue) 17 | { 18 | minValue = currentValue; 19 | minIndex = i; 20 | } 21 | } 22 | return minIndex; 23 | } 24 | 25 | int 26 | avl_minindex(const int sequence[]) 27 | { 28 | int minIndex = 0; 29 | int minValue = sequence[minIndex]; 30 | int currentValue; 31 | for (int i = 1; i < len(sequence); ++i) 32 | { 33 | currentValue = sequence[i]; 34 | if (currentValue < minValue) 35 | { 36 | minValue = currentValue; 37 | minIndex = i; 38 | } 39 | } 40 | return minIndex; 41 | } 42 | 43 | #endif // _AVL_MININDEX_H_ 44 | -------------------------------------------------------------------------------- /vex/include/avl_randint.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_RANDINT_H_ 3 | #define _AVL_RANDINT_H_ 4 | 5 | #include "avl_randrange.h" 6 | 7 | int 8 | avl_randint(const float seed; 9 | const int min; 10 | const int max) 11 | { 12 | return avl_randrange(seed, min, max + 1); 13 | } 14 | 15 | int 16 | avl_randint(const float seed; 17 | const float seed2; 18 | const int min; 19 | const int max) 20 | { 21 | return avl_randrange(seed, seed2, min, max + 1); 22 | } 23 | 24 | int 25 | avl_randint(const vector2 seed; 26 | const int min; 27 | const int max) 28 | { 29 | return avl_randrange(seed, min, max + 1); 30 | } 31 | 32 | int 33 | avl_randint(const vector seed; 34 | const int min; 35 | const int max) 36 | { 37 | return avl_randrange(seed, min, max + 1); 38 | } 39 | 40 | int 41 | avl_randint(const vector4 seed; 42 | const int min; 43 | const int max) 44 | { 45 | return avl_randrange(seed, min, max + 1); 46 | } 47 | 48 | #endif // _AVL_RANDINT_H_ 49 | -------------------------------------------------------------------------------- /vex/include/avl_filepath.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_FILEPATH_H_ 3 | #define _AVL_FILEPATH_H_ 4 | 5 | #include "avl_splitext.h" 6 | 7 | struct avl_filepath 8 | { 9 | string filepath; 10 | void set(const string path) 11 | { 12 | // 13 | } 14 | string folderPath() 15 | { 16 | // 17 | } 18 | string folderName() 19 | { 20 | // 21 | } 22 | string fileName() 23 | { 24 | // 25 | } 26 | string exntension() 27 | { 28 | return avl_splitext(this.filepath); 29 | } 30 | string fileNameWithExtension() 31 | { 32 | return concat(this->fileName(), '.', this->exntension()) 33 | } 34 | int isNetwork() 35 | { 36 | return startswith(this.filepath, '//') || startswith(this.filepath, '\\\\'); 37 | } 38 | int isWeb() 39 | { 40 | return startswith(this.filepath, 'http') || startswith(this.filepath, 'www'); 41 | } 42 | int isLocal() 43 | { 44 | return !(this->isNetwork() || this->isWeb()); 45 | } 46 | } 47 | 48 | #endif // _AVL_FILEPATH_H_ 49 | -------------------------------------------------------------------------------- /vex/include/avl_copypoint.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_COPYPOINT_H_ 3 | #define _AVL_COPYPOINT_H_ 4 | 5 | #include "avl_copypointattribs.h" 6 | #include "avl_copypointgroups.h" 7 | 8 | int 9 | avl_copypoint(const int geohandle; const int ptnum) // For compatibility with avl_copyprim 10 | { 11 | return addpoint(geohandle, ptnum); 12 | } 13 | 14 | int 15 | avl_copypoint(const int geometry; 16 | const int geohandle; 17 | const int ptnum) 18 | { 19 | int pointCopy = addpoint(geohandle, {0, 0, 0}); 20 | avl_copypointattribs(geometry, geohandle, ptnum, pointCopy); 21 | avl_copypointgroups(geometry, geohandle, ptnum, pointCopy); 22 | return pointCopy; 23 | } 24 | 25 | int 26 | avl_copypoint(const string geometry; 27 | const int geohandle; 28 | const int ptnum) 29 | { 30 | int pointCopy = addpoint(geohandle, {0, 0, 0}); 31 | avl_copypointattribs(geometry, geohandle, ptnum, pointCopy); 32 | avl_copypointgroups(geometry, geohandle, ptnum, pointCopy); 33 | return pointCopy; 34 | } 35 | 36 | #endif // _AVL_COPYPOINT_H_ 37 | -------------------------------------------------------------------------------- /vex/include/avl_median.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_MEDIAN_H_ 3 | #define _AVL_MEDIAN_H_ 4 | 5 | #include "avl_iseven.h" 6 | 7 | float 8 | avl_median(const float sequence[]) 9 | { 10 | float sorted[] = sort(sequence); 11 | int sequenceLength = len(sorted); 12 | if (avl_iseven(sequenceLength)) 13 | return (sorted[(sequenceLength - 1) / 2] + sorted[sequenceLength / 2]) * 0.5; 14 | else 15 | return sorted[sequenceLength / 2]; 16 | } 17 | 18 | float 19 | avl_median(const int sequence[]) 20 | { 21 | int sorted[] = sort(sequence); 22 | int sequenceLength = len(sorted); 23 | if (avl_iseven(sequenceLength)) 24 | return (sorted[(sequenceLength - 1) / 2] + sorted[sequenceLength / 2]) * 0.5; 25 | else 26 | return sorted[sequenceLength / 2]; 27 | } 28 | 29 | // Todo (1.0): vector2 avl_median(const vector2[]) 30 | 31 | // Todo (1.0): vector avl_median(const vector[]) 32 | 33 | // Todo (2.0): float avl_median(const float; const float; const float ...) 34 | 35 | // Todo (2.0): float avl_median(const int; const int; const int ...) 36 | 37 | #endif // _AVL_MEDIAN_H_ 38 | -------------------------------------------------------------------------------- /vex/include/avl_polyvolume.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_POLYVOLUME_H_ 3 | #define _AVL_POLYVOLUME_H_ 4 | 5 | #include "avl_trinormal.h" 6 | #include "avl_trivolume.h" 7 | 8 | float 9 | avl_polyvolume(const vector origin; const vector vertices[]) // Todo: optimize 10 | { 11 | if (len(vertices) < 3) 12 | error('Number of points must be greater than 3'); // Todo: rework 13 | float volume = 0; 14 | float value = 0; 15 | vector norm = avl_trinormal(vertices[0], 16 | vertices[1], 17 | vertices[2]); 18 | vector centroid = avg(vertices); 19 | for (int i = -1; i < len(vertices)-1; ++i) 20 | { 21 | value = avl_trivolume(origin, 22 | vertices[0], 23 | vertices[i], 24 | vertices[i+1]); 25 | if (dot(norm, centroid) < 0) 26 | volume += value; 27 | else 28 | volume -= value; 29 | } 30 | return abs(volume); 31 | } 32 | 33 | // Todo (2.0): float polyvolume(const vector; const vector ...) 34 | 35 | #endif // _AVL_POLYVOLUME_H_ 36 | -------------------------------------------------------------------------------- /vex/include/avl_copydetailattribs.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_COPYDETAILATTRIBS_H_ 3 | #define _AVL_COPYDETAILATTRIBS_H_ 4 | 5 | #include "avl_detailattribs.h" 6 | #include "avl_copydetailattrib.h" 7 | 8 | void 9 | avl_copydetailattribs(const int geometry; const int geohandle) 10 | { 11 | for (string attribName : avl_detailattribs(geometry)) 12 | avl_copydetailattrib(geometry, geohandle, attribName); 13 | } 14 | 15 | void 16 | avl_copydetailattribs(const int geometry; 17 | const int geohandle; 18 | const string mode) 19 | { 20 | for (string attribName : avl_detailattribs(geometry)) 21 | avl_copydetailattrib(geometry, geohandle, attribName, mode); 22 | } 23 | 24 | void 25 | avl_copydetailattribs(const int geometry; 26 | const int geohandle; 27 | const string mode; 28 | const string pattern) 29 | { 30 | for (string attribName : avl_detailattribs(geometry)) 31 | if (match(pattern, attribName)) 32 | avl_copydetailattrib(geometry, geohandle, attribName, mode); 33 | } 34 | 35 | #endif // _AVL_COPYDETAILATTRIBS_H_ 36 | -------------------------------------------------------------------------------- /vex/include/avl_primtype.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_PRIMTYPE_H_ 3 | #define _AVL_PRIMTYPE_H_ 4 | 5 | #define AVL_PRIMTYPE_POLY 1 6 | #define AVL_PRIMTYPE_NURBCURVE 2 7 | #define AVL_PRIMTYPE_BEZIERCURVE 3 8 | #define AVL_PRIMTYPE_MESH 4 9 | #define AVL_PRIMTYPE_NURBMESH 5 10 | #define AVL_PRIMTYPE_BEZIERMESH 6 11 | #define AVL_PRIMTYPE_CIRCLE 8 12 | #define AVL_PRIMTYPE_SPHERE 9 13 | #define AVL_PRIMTYPE_TUBE 10 14 | #define AVL_PRIMTYPE_PART 11 15 | #define AVL_PRIMTYPE_METABALL 12 16 | #define AVL_PRIMTYPE_METASQUAD 13 17 | #define AVL_PRIMTYPE_VOLUME 20 18 | #define AVL_PRIMTYPE_TETRAHEDRON 21 19 | #define AVL_PRIMTYPE_POLYSOUP 22 20 | #define AVL_PRIMTYPE_VDB 23 21 | #define AVL_PRIMTYPE_PACKEDGEOMETRY 24 22 | #define AVL_PRIMTYPE_PACKEDDISK 25 23 | #define AVL_PRIMTYPE_PACKEDAGENT 27 24 | #define AVL_PRIMTYPE_PACKEDDISKSEQUENCE 28 25 | #define AVL_PRIMTYPE_ALEMBICREF 29 26 | 27 | int 28 | avl_primtype(const int geometry; const int primnum) 29 | { 30 | return primintrinsic(geometry, 'typeid', primnum); 31 | } 32 | 33 | int 34 | avl_primtype(const string geometry; const int primnum) 35 | { 36 | return primintrinsic(geometry, 'typeid', primnum); 37 | } 38 | 39 | #endif // _AVL_PRIMTYPE_H_ 40 | -------------------------------------------------------------------------------- /vex/include/avl_copyedgegroup.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_COPYEDGEGROUP_H_ 3 | #define _AVL_COPYEDGEGROUP_H_ 4 | 5 | #include "avl_setedgegroup.h" 6 | 7 | int 8 | avl_copyedgegroup(const int geometry; 9 | const int geohandle; 10 | const int srcPtnum0; 11 | const int srcPtnum1; 12 | const int dstPtnum0; 13 | const int dstPtnum1; 14 | const string groupName) 15 | { 16 | int value = inedgegroup(geometry, groupName, srcPtnum0, srcPtnum1); 17 | return setedgegroup(geohandle, groupName, dstPtnum0, dstPtnum1, value); 18 | } 19 | 20 | int 21 | avl_copyedgegroup(const int geometry; 22 | const int geohandle; 23 | const int srcPtnum0; 24 | const int srcPtnum1; 25 | const int dstPtnum0; 26 | const int dstPtnum1; 27 | const string groupName; 28 | const string mode) 29 | { 30 | int value = inedgegroup(geometry, groupName, srcPtnum0, srcPtnum1); 31 | return avl_setedgegroup(geohandle, groupName, dstPtnum0, dstPtnum1, value, mode); 32 | } 33 | 34 | #endif // _AVL_COPYEDGEGROUP_H_ 35 | -------------------------------------------------------------------------------- /vex/include/avl_pointcurvature.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_POINTCURVATURE_H_ 3 | #define _AVL_POINTCURVATURE_H_ 4 | 5 | float 6 | avl_pointcurvature(const int geometry; const int ptnum) 7 | { 8 | int pointNeighbours[] = neighbours(geometry, ptnum); 9 | vector directions = {0, 0, 0}; 10 | vector pointPosition = point(geometry, 'P', ptnum); 11 | for (int neighbourPoint : pointNeighbours) 12 | directions += normalize(pointPosition - point(geometry, 'P', neighbourPoint)); 13 | vector pointNormal = normalize(vector(point(geometry, 'N', ptnum))); 14 | return dot(pointNormal, directions / len(pointNeighbours)); 15 | } 16 | 17 | float 18 | avl_pointcurvature(const string geometry; const int ptnum) 19 | { 20 | int pointNeighbours[] = neighbours(geometry, ptnum); 21 | vector directions = {0, 0, 0}; 22 | vector pointPosition = point(geometry, 'P', ptnum); 23 | for (int neighbourPoint : pointNeighbours) 24 | directions += normalize(pointPosition - point(geometry, 'P', neighbourPoint)); 25 | vector pointNormal = normalize(vector(point(geometry, 'N', ptnum))); 26 | return dot(pointNormal, directions / len(pointNeighbours)); 27 | } 28 | 29 | #endif // _AVL_POINTCURVATURE_H_ 30 | -------------------------------------------------------------------------------- /vex/include/avl_setedgegroup.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_SETEDGEGROUP_H_ 3 | #define _AVL_SETEDGEGROUP_H_ 4 | 5 | int 6 | avl_setedgegroup(const int dstGeometry; 7 | const string groupName; 8 | const int srcEdgePoint; 9 | const int dstEdgePoint; 10 | const int value; 11 | const string mode) 12 | { 13 | if (mode == 'set') 14 | return setedgegroup(dstGeometry, groupName, srcEdgePoint, dstEdgePoint, srcValue); 15 | int srcValue = inedgegroup(dstGeometry, groupName, srcEdgePoint, dstEdgePoint); 16 | if (mode == 'toggle') 17 | return setedgegroup(dstGeometry, groupName, srcEdgePoint, dstEdgePoint, 1 - srcValue); 18 | if (mode == 'min' || mode == 'minimum') 19 | return setedgegroup(dstGeometry, groupName, srcEdgePoint, dstEdgePoint, min(srcValue, value)); 20 | if (mode == 'max' || mode == 'maximum') 21 | return setedgegroup(dstGeometry, groupName, srcEdgePoint, dstEdgePoint, max(srcValue, value)); 22 | if (mode == 'mult' || mode == 'multiply') 23 | return setedgegroup(dstGeometry, groupName, srcEdgePoint, dstEdgePoint, srcValue * value); 24 | } 25 | 26 | #endif // _AVL_SETEDGEGROUP_H_ 27 | -------------------------------------------------------------------------------- /vex/test/run.py: -------------------------------------------------------------------------------- 1 | from __future__ import print_function 2 | 3 | import os 4 | import sys 5 | from subprocess import check_output 6 | 7 | def root(): 8 | return os.path.dirname(__file__).replace('\\', '/') 9 | 10 | def run_test(bin_folder, test_file=None): 11 | avl_test_file = test_file or os.path.join(root(), 'avl_test.vfl').replace('\\', '/') 12 | avl_vex_test_file = avl_test_file[:-3] + 'vex' 13 | print(avl_test_file) 14 | if not os.path.exists(avl_test_file): return 15 | os.environ['HOUDINI_VEX_ASSERT'] = '1' 16 | print(check_output(bin_folder + '/vcc.exe {0} -o {1} -V -I {2}'.format(avl_test_file, 17 | avl_vex_test_file, 18 | os.path.dirname(avl_test_file).replace('\\', '/') + '/../include/'), 19 | shell=False).decode('utf-8')) 20 | print(check_output(bin_folder + '/vexexec.exe ' + avl_vex_test_file, shell=False).decode('utf-8')) 21 | 22 | if __name__ == '__main__': 23 | if len(sys.argv) > 1: 24 | run_test(sys.argv[1]) 25 | else: 26 | print('Path to Houdini bin folder not found.') 27 | input('Press enter to exit...') 28 | exit() 29 | -------------------------------------------------------------------------------- /vex/include/avl_hedge_opposite.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_HEDGE_OPPOSITE_H_ 3 | #define _AVL_HEDGE_OPPOSITE_H_ 4 | 5 | #include "avl_isodd.h" 6 | 7 | int 8 | avl_hedge_opposite(const int geometry; const int hedge) 9 | { 10 | int primnum = hedge_prim(geometry, hedge); 11 | if (int(primintrinsic(geometry, 'closed', primnum)) == 0 || primnum < 0) 12 | return -1; 13 | int hedgeCount = primvertexcount(geometry, primnum); 14 | if (avl_isodd(hedgeCount)) 15 | return -1; 16 | int oppositeHedge = hedge; 17 | for (int i = 0; i < hedgeCount / 2; ++i) 18 | oppositeHedge = hedge_next(geometry, oppositeHedge); 19 | return oppositeHedge; 20 | } 21 | 22 | int 23 | avl_hedge_opposite(const string geometry; const int hedge) 24 | { 25 | int primnum = hedge_prim(geometry, hedge); 26 | if (int(primintrinsic(geometry, 'closed', primnum)) == 0 || primnum < 0) 27 | return -1; 28 | int hedgeCount = primvertexcount(geometry, primnum); 29 | if (avl_isodd(hedgeCount)) 30 | return -1; 31 | int oppositeHedge = hedge; 32 | for (int i = 0; i < hedgeCount / 2; ++i) 33 | oppositeHedge = hedge_next(geometry, oppositeHedge); 34 | return oppositeHedge; 35 | } 36 | 37 | #endif // _AVL_HEDGE_OPPOSITE_H_ 38 | -------------------------------------------------------------------------------- /vex/include/avl_assert.h: -------------------------------------------------------------------------------- 1 | #ifndef _AVL_ASSERT_H_ 2 | #define _AVL_ASSERT_H_ 3 | 4 | #define assert(EXPR) \ 5 | if (assert_enabled()) \ 6 | { \ 7 | if (!(EXPR)) print_once(sprintf('Test Failed %s:%d - (%s)\n', __FILE__, __LINE__, #EXPR)); \ 8 | } 9 | 10 | #define assertAlmostEqual(EXPR, VALUE, TOLERANCE) \ 11 | if (assert_enabled()) \ 12 | { \ 13 | if (abs(EXPR-VALUE) > TOLERANCE) print_once(sprintf('Test Failed %s:%d - (%s not almost equal %s)\n', __FILE__, __LINE__, #EXPR, #VALUE)); \ 14 | } 15 | 16 | #define assertNotAlmostEqual(EXPR, VALUE, TOLERANCE) \ 17 | if (assert_enabled()) \ 18 | { \ 19 | if (abs(EXPR-VALUE) <= TOLERANCE) print_once(sprintf('Test Failed %s:%d - (%s almost equal %s)\n', __FILE__, __LINE__, #EXPR, #VALUE)); \ 20 | } 21 | 22 | #define assertRegex(EXPR, REGEX) \ 23 | if (assert_enabled()) \ 24 | { \ 25 | if (!re_match(REGEX, EXPR)) print_once(sprintf('Test Failed %s:%d - (%s not matches %s)\n', __FILE__, __LINE__, #EXPR, #REGEX)); \ 26 | } 27 | 28 | #define assertNotRegex(EXPR, REGEX) \ 29 | if (assert_enabled()) \ 30 | { \ 31 | if (re_match(REGEX, EXPR)) print_once(sprintf('Test Failed %s:%d - (%s matches %s)\n', __FILE__, __LINE__, #EXPR, #REGEX)); \ 32 | } 33 | 34 | #endif // _AVL_ASSERT_H_ 35 | -------------------------------------------------------------------------------- /toolbar/avl.shelf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /vex/include/avl_triperimeter.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_TRIPERIMETER_H_ 3 | #define _AVL_TRIPERIMETER_H_ 4 | 5 | float 6 | avl_triperimeter(const vector2 vertex1; 7 | const vector2 vertex2; 8 | const vector2 vertex3) 9 | { 10 | return distance(vertex1, vertex2) + 11 | distance(vertex2, vertex3) + 12 | distance(vertex3, vertex1); 13 | } 14 | 15 | float 16 | avl_triperimeter(const vector2 vertices[]) 17 | { 18 | // Todo (1.0): Triangle check 19 | return distance(vertices[0], vertices[1]) + 20 | distance(vertices[1], vertices[2]) + 21 | distance(vertices[2], vertices[0]); 22 | } 23 | 24 | float 25 | avl_triperimeter(const vector vertex1; 26 | const vector vertex2; 27 | const vector vertex3) 28 | { 29 | return distance(vertex1, vertex2) + 30 | distance(vertex2, vertex3) + 31 | distance(vertex3, vertex1); 32 | } 33 | 34 | float 35 | avl_triperimeter(const vector vertices[]) 36 | { 37 | // Todo (1.0): Triangle check 38 | return distance(vertices[0], vertices[1]) + 39 | distance(vertices[1], vertices[2]) + 40 | distance(vertices[2], vertices[0]); 41 | } 42 | 43 | // Todo (1.0): float avl_triperimeter(; int point1; int point2; int point3) 44 | 45 | #endif // _AVL_TRIPERIMETER_H_ 46 | -------------------------------------------------------------------------------- /vex/include/avl_shuffle.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_SHUFFLE_H_ 3 | #define _AVL_SHUFFLE_H_ 4 | 5 | #include "avl_randint.h" 6 | #include "avl_swap.h" 7 | 8 | float[] 9 | avl_shuffle(const float sequence[]; const float seed) 10 | { 11 | float shuffledSequence[] = sequence; 12 | int j; 13 | for (int i = len(sequence)-1; i != 0; --i) 14 | { 15 | j = int(avl_randint(i * seed, 0, i)); 16 | avl_swap(shuffledSequence[i], shuffledSequence[j]); 17 | } 18 | return shuffledSequence; 19 | } 20 | /* 21 | int[] 22 | avl_shuffle(const int sequence[]; const float seed) 23 | { 24 | // 25 | } 26 | 27 | string[] 28 | avl_shuffle(const string sequence[]; const float seed) 29 | { 30 | // 31 | } 32 | 33 | vector2[] 34 | avl_shuffle(const vector2 sequence[]; const float seed) 35 | { 36 | // 37 | } 38 | 39 | vector[] 40 | avl_shuffle(const vector sequence[]; const float seed) 41 | { 42 | // 43 | } 44 | 45 | vector4[] 46 | avl_shuffle(const vector4 sequence[]; const float seed) 47 | { 48 | // 49 | } 50 | 51 | matrix2[] 52 | avl_shuffle(const matrix2 sequence[]; const float seed) 53 | { 54 | // 55 | } 56 | 57 | matrix3[] 58 | avl_shuffle(const matrix3 sequence[]; const float seed) 59 | { 60 | // 61 | } 62 | 63 | matrix[] 64 | avl_shuffle(const matrix sequence[]; const float seed) 65 | { 66 | // 67 | } 68 | */ 69 | #endif // _AVL_SHUFFLE_H_ 70 | -------------------------------------------------------------------------------- /vex/test/avl_test.vfl: -------------------------------------------------------------------------------- 1 | #include "avl_assert.h" 2 | #include "avl.h" 3 | 4 | cvex 5 | avl_tests() 6 | { 7 | avl_print('AVL Test Started'); 8 | 9 | // avl_count 10 | assert(avl_count('NO DIGITS', '12') == 0); 11 | assert(avl_count('Even seven', 'e') == 3); 12 | assert(avl_count('houdini best of the best', 'best') == 2); 13 | assert(avl_count({-2, 22, 2, 20, 12, -2, 2, 2}, 2) == 3); 14 | 15 | // avl_padzero 16 | assert(avl_padzero(32, 4) == '0032'); 17 | assert(avl_padzero(0, 4) == '0000'); 18 | assert(avl_padzero(32, 1) == '32'); 19 | 20 | // avl_isinsphere 21 | assert(avl_isinsphere({0.5, 0.5, 1}, {0, 0, 0}, 2) == 1); 22 | assert(avl_isinsphere({1, 0, 0}, {0, 0, 0}, 1) == 1); 23 | assert(avl_isinsphere({1, 0, 0}, {0, 0, 0}, 0.99999) == 0); 24 | 25 | // avl_angle 26 | assertAlmostEqual(avl_angle({1, 1, 0}, {1, 1, 0}), 0.0, 0.00001); 27 | assertAlmostEqual(avl_angle({1, 0, 0}, {0, 1, 0}), 1.5708, 0.0001); 28 | assertAlmostEqual(avl_angle({5, 0, 0}, {0, 10, 0}), 1.5708, 0.0001); 29 | assertAlmostEqual(avl_angle({1, 0, 0}, {-1, 0, 0}), 3.14159, 0.00001); 30 | 31 | // avl_median 32 | assertAlmostEqual(avl_median({14.05, 34.1, 45, 1}), 24.075, 0.0001); 33 | assertAlmostEqual(avl_median({2, 7, 1}), 2, 0.00001); 34 | 35 | // avl_medianhigh 36 | 37 | // avl_medianlow 38 | avl_print('AVL Test Finished'); 39 | } 40 | -------------------------------------------------------------------------------- /vex/include/avl_triarea.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_TRIAREA_H_ 3 | #define _AVL_TRIAREA_H_ 4 | 5 | float 6 | avl_triarea(const vector2 vertex1; 7 | const vector2 vertex2; 8 | const vector2 vertex3) 9 | { 10 | return abs((vertex2.x - vertex1.x) * (vertex3.y - vertex1.y) - 11 | (vertex3.x - vertex1.x) * (vertex2.y - vertex1.y)) * 0.5; 12 | } 13 | 14 | float 15 | avl_triarea(const vector2 vertices[]) 16 | { 17 | if (len(vertices) != 3) 18 | return 0; // Not triangle // Todo (1.0): Error 19 | return abs((vertices[1].x - vertices[0].x) * (vertices[2].y - vertices[0].y) - 20 | (vertices[2].x - vertices[0].x) * (vertices[1].y - vertices[0].y)) * 0.5; 21 | } 22 | 23 | float 24 | avl_triarea(const vector vertex1; 25 | const vector vertex2; 26 | const vector vertex3) 27 | { 28 | vector edge1 = vertex1 - vertex2; 29 | vector edge2 = vertex1 - vertex3; 30 | return length(cross(edge1, edge2)) * 0.5; 31 | } 32 | 33 | float 34 | avl_triarea(const vector vertices[]) 35 | { 36 | if (len(vertices) != 3) 37 | return 0; // Not triangle // Todo (1.0): Error 38 | vector edge1 = vertices[0] - vertices[1]; 39 | vector edge2 = vertices[0] - vertices[2]; 40 | return length(cross(edge1, edge2)) * 0.5; 41 | } 42 | 43 | // Todo (1.0): float avl_triarea(; int point1; int point2; int point3) 44 | 45 | #endif // _AVL_TRIAREA_H_ 46 | -------------------------------------------------------------------------------- /vex/include/avl_copypointattribs.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_COPYPOINTATTRIBS_H_ 3 | #define _AVL_COPYPOINTATTRIBS_H_ 4 | 5 | #include "avl_pointattribs.h" 6 | #include "avl_copypointattrib.h" 7 | 8 | void 9 | avl_copypointattribs(const int geometry; 10 | const int geohandle; 11 | const int srcPtnum; 12 | const int dstPtnum) 13 | { 14 | for (string attribName : avl_pointattribs(geometry)) 15 | avl_copypointattrib(geometry, geohandle, srcPtnum, dstPtnum, attribName); 16 | } 17 | 18 | void 19 | avl_copypointattribs(const int geometry; 20 | const int geohandle; 21 | const int srcPtnum; 22 | const int dstPtnum; 23 | const string mode) 24 | { 25 | for (string attribName : avl_pointattribs(geometry)) 26 | avl_copypointattrib(geometry, geohandle, srcPtnum, dstPtnum, attribName, mode); 27 | } 28 | 29 | void 30 | avl_copypointattribs(const int geometry; 31 | const int geohandle; 32 | const int srcPtnum; 33 | const int dstPtnum; 34 | const string mode; 35 | const string pattern) 36 | { 37 | for (string attribName : avl_pointattribs(geometry)) 38 | if (match(pattern, attribName)) 39 | avl_copypointattrib(geometry, geohandle, srcPtnum, dstPtnum, attribName, mode); 40 | } 41 | 42 | #endif // _AVL_COPYPOINTATTRIBS_H_ 43 | -------------------------------------------------------------------------------- /vex/include/avl_copypointgroups.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_COPYPOINTGROUPS_H_ 3 | #define _AVL_COPYPOINTGROUPS_H_ 4 | 5 | #include "avl_pointgroups.h" 6 | #include "avl_copypointgroup.h" 7 | 8 | void 9 | avl_copypointgroups(const int geometry; 10 | const int geohandle; 11 | const int srcPtnum; 12 | const int dstPtnum) 13 | { 14 | for (string groupName : avl_pointgroups(geometry)) 15 | avl_copypointgroup(geometry, geohandle, srcPtnum, dstPtnum, groupName); 16 | } 17 | 18 | void 19 | avl_copypointgroups(const int geometry; 20 | const int geohandle; 21 | const int srcPtnum; 22 | const int dstPtnum; 23 | const string mode) 24 | { 25 | for (string groupName : avl_pointgroups(geometry)) 26 | avl_copypointgroup(geometry, geohandle, srcPtnum, dstPtnum, groupName, mode); 27 | } 28 | 29 | void 30 | avl_copypointgroups(const int geometry; 31 | const int geohandle; 32 | const int srcPtnum; 33 | const int dstPtnum; 34 | const string pattern; 35 | const string mode) 36 | { 37 | for (string groupName : avl_pointgroups(geometry)) 38 | if (match(pattern, groupName)) 39 | avl_copypointgroup(geometry, geohandle, srcPtnum, dstPtnum, groupName, mode); 40 | } 41 | 42 | #endif // _AVL_COPYPOINTGROUPS_H_ 43 | -------------------------------------------------------------------------------- /vex/include/avl_copyprimgroups.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_COPYPRIMGROUPS_H_ 3 | #define _AVL_COPYPRIMGROUPS_H_ 4 | 5 | #include "avl_primgroups.h" 6 | #include "avl_copyprimgroup.h" 7 | 8 | void 9 | avl_copyprimgroups(const int geometry; 10 | const int geohandle; 11 | const int srcPrimnum; 12 | const int dstPrimnum) 13 | { 14 | for (string groupName : avl_primgroups(geometry)) 15 | avl_copyprimgroup(geometry, geohandle, srcPrimnum, dstPrimnum, groupName); 16 | } 17 | 18 | void 19 | avl_copyprimgroups(const int geometry; 20 | const int geohandle; 21 | const int srcPrimnum; 22 | const int dstPrimnum; 23 | const string mode) 24 | { 25 | for (string groupName : avl_primgroups(geometry)) 26 | avl_copyprimgroup(geometry, geohandle, srcPrimnum, dstPrimnum, groupName, mode); 27 | } 28 | 29 | void 30 | avl_copyprimgroups(const int geometry; 31 | const int geohandle; 32 | const int srcPrimnum; 33 | const int dstPrimnum; 34 | const string mode; 35 | const string pattern) 36 | { 37 | for (string groupName : avl_primgroups(geometry)) 38 | if (match(pattern, groupName)) 39 | avl_copyprimgroup(geometry, geohandle, srcPrimnum, dstPrimnum, groupName, mode); 40 | } 41 | 42 | #endif // _AVL_COPYPRIMGROUPS_H_ 43 | -------------------------------------------------------------------------------- /vex/include/avl_copyprimattribs.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_COPYPRIMATTRIBS_H_ 3 | #define _AVL_COPYPRIMATTRIBS_H_ 4 | 5 | #include "avl_primattribs.h" 6 | #include "avl_copyprimattrib.h" 7 | 8 | void 9 | avl_copyprimattribs(const int geometry; 10 | const int geohandle; 11 | const int srcPrimnum; 12 | const int dstPrimnum) 13 | { 14 | for (string attribName : avl_primattribs(geometry)) 15 | avl_copyprimattrib(geometry, geohandle, srcPrimnum, dstPrimnum, attribName); 16 | } 17 | 18 | void 19 | avl_copyprimattribs(const int geometry; 20 | const int geohandle; 21 | const int srcPrimnum; 22 | const int dstPrimnum; 23 | const string mode) 24 | { 25 | for (string attribName : avl_primattribs(geometry)) 26 | avl_copyprimattrib(geometry, geohandle, srcPrimnum, dstPrimnum, attribName, mode); 27 | } 28 | 29 | void 30 | avl_copyprimattribs(const int geometry; 31 | const int geohandle; 32 | const int srcPrimnum; 33 | const int dstPrimnum; 34 | const string mode; 35 | const string pattern) 36 | { 37 | for (string attribName : avl_primattribs(geometry)) 38 | if (match(pattern, attribName)) 39 | avl_copyprimattrib(geometry, geohandle, srcPrimnum, dstPrimnum, attribName, mode); 40 | } 41 | 42 | #endif // _AVL_COPYPRIMATTRIBS_H_ 43 | -------------------------------------------------------------------------------- /vex/include/avl_copyvertexgroups.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_COPYVERTEXGROUPS_H_ 3 | #define _AVL_COPYVERTEXGROUPS_H_ 4 | 5 | #include "avl_vertexgroups.h" 6 | #include "avl_copyvertexgroup.h" 7 | 8 | void 9 | avl_copyvertexgroups(const int geometry; 10 | const int geohandle; 11 | const int srcVtxnum; 12 | const int dstVtxnum) 13 | { 14 | for (string groupName : avl_vertexgroups(geometry)) 15 | avl_copyvertexgroup(geometry, geohandle, srcVtxnum, dstVtxnum, groupName); 16 | } 17 | 18 | void 19 | avl_copyvertexgroups(const int geometry; 20 | const int geohandle; 21 | const int srcVtxnum; 22 | const int dstVtxnum; 23 | const string mode) 24 | { 25 | for (string groupName : avl_vertexgroups(geometry)) 26 | avl_copyvertexgroup(geometry, geohandle, srcVtxnum, dstVtxnum, groupName, mode); 27 | } 28 | 29 | void 30 | avl_copyvertexgroups(const int geometry; 31 | const int geohandle; 32 | const int srcVtxnum; 33 | const int dstVtxnum; 34 | const string mode; 35 | const string pattern) 36 | { 37 | for (string groupName : avl_vertexgroups(geometry)) 38 | if (match(pattern, groupName)) 39 | avl_copyvertexgroup(geometry, geohandle, srcVtxnum, dstVtxnum, groupName, mode); 40 | } 41 | 42 | #endif // _AVL_COPYVERTEXGROUPS_H_ 43 | -------------------------------------------------------------------------------- /vex/include/avl_istiny.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_ISTINY_H_ 3 | #define _AVL_ISTINY_H_ 4 | 5 | #include 6 | 7 | int 8 | avl_istiny(const int geometry; 9 | const int primnum; 10 | const float epsilon) 11 | { 12 | int points[] = primpoints(geometry, primnum); 13 | float epsilon2 = epsilon * epsilon; 14 | for (int pt = len(points) - 2; pt > -2; --pt) 15 | { 16 | vector position1 = point(geometry, 'P', points[pt]); 17 | vector position2 = point(geometry, 'P', points[pt+1]); 18 | if (distance2(position1, position2) < epsilon2) 19 | return 1; 20 | } 21 | return 0; 22 | } 23 | 24 | int 25 | avl_istiny(const int geometry; const int primnum) 26 | { 27 | return avl_istiny(geometry, primnum, M_TOLERANCE); 28 | } 29 | 30 | int 31 | avl_istiny(const string geometry; 32 | const int primnum; 33 | const float epsilon) 34 | { 35 | int points[] = primpoints(geometry, primnum); 36 | float epsilon2 = epsilon * epsilon; 37 | for (int pt = len(points) - 2; pt > -2; --pt) 38 | { 39 | vector position1 = point(geometry, 'P', points[pt]); 40 | vector position2 = point(geometry, 'P', points[pt+1]); 41 | if (distance2(position1, position2) < epsilon2) 42 | return 1; 43 | } 44 | return 0; 45 | } 46 | 47 | int 48 | avl_istiny(const string geometry; const int primnum) 49 | { 50 | return avl_istiny(geometry, primnum, M_TOLERANCE); 51 | } 52 | 53 | #endif // _AVL_ISTINY_H_ 54 | -------------------------------------------------------------------------------- /vex/include/avl_removevertex.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_REMOVEVERTEX_H_ 3 | #define _AVL_REMOVEVERTEX_H_ 4 | 5 | void 6 | avl_removevertex(const int geohandle; 7 | const int primnum; 8 | const int vtxnum) 9 | { 10 | int destinationPoint = addpoint(geohandle, {0, 0, 0}); 11 | setvertexpoint(geohandle, primnum, vtxnum, destinationPoint); 12 | removepoint(geohandle, destinationPoint); 13 | } 14 | 15 | void 16 | avl_removevertex(const int geohandle; 17 | const int primnum; 18 | const int vtxnum; 19 | const int mode) 20 | { 21 | if (mode == 1) 22 | { 23 | int sourcePoint; 24 | if (primnum == -1) 25 | sourcePoint = vertexpoint(geohandle, vtxnum); 26 | else 27 | sourcePoint = vertexpoint(geohandle, primvertex(geohandle, 28 | primnum, 29 | vtxnum)); 30 | int connectedVertexCount = len(pointvertices(geohandle, sourcePoint)); 31 | if (connectedVertexCount == 1) 32 | removepoint(geohandle, sourcePoint); 33 | else 34 | avl_removevertex(geohandle, primnum, vtxnum); 35 | } else 36 | avl_removevertex(geohandle, primnum, vtxnum); 37 | } 38 | 39 | void 40 | avl_removevertex(const int geohandle; const int vtxnum) 41 | { 42 | avl_removevertex(geohandle, -1, vtxnum); 43 | } 44 | 45 | #endif // _AVL_REMOVEVERTEX_H_ 46 | -------------------------------------------------------------------------------- /vex/include/avl_copyvertexattribs.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_COPYVERTEXATTRIBS_H_ 3 | #define _AVL_COPYVERTEXATTRIBS_H_ 4 | 5 | #include "avl_vertexattribs.h" 6 | #include "avl_copyvertexattrib.h" 7 | 8 | void 9 | avl_copyvertexattribs(const int geometry; 10 | const int geohandle; 11 | const int srcVtxnum; 12 | const int dstVtxnum) 13 | { 14 | for (string attribName : avl_vertexattribs(geometry)) 15 | avl_copyvertexattrib(geometry, geohandle, srcVtxnum, dstVtxnum, attribName); 16 | } 17 | 18 | void 19 | avl_copyvertexattribs(const int geometry; 20 | const int geohandle; 21 | const int srcVtxnum; 22 | const int dstVtxnum; 23 | const string mode) 24 | { 25 | for (string attribName : avl_vertexattribs(geometry)) 26 | avl_copyvertexattrib(geometry, geohandle, srcVtxnum, dstVtxnum, attribName, mode); 27 | } 28 | 29 | void 30 | avl_copyvertexattribs(const int geometry; 31 | const int geohandle; 32 | const int srcVtxnum; 33 | const int dstVtxnum; 34 | const string mode; 35 | const string pattern) 36 | { 37 | for (string attribName : avl_vertexattribs(geometry)) 38 | if (match(pattern, attribName)) 39 | avl_copyvertexattrib(geometry, geohandle, srcVtxnum, dstVtxnum, attribName, mode); 40 | } 41 | 42 | #endif // _AVL_COPYVERTEXATTRIBS_H_ 43 | -------------------------------------------------------------------------------- /vex/include/avl_sample.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_SAMPLE_H_ 3 | #define _AVL_SAMPLE_H_ 4 | 5 | #include "avl_randrange.h" 6 | #include "avl_in.h" 7 | 8 | float 9 | avl_sample(const float sequence[]; 10 | const int size; 11 | const float seed) 12 | { 13 | sequenceLength = len(sequence); 14 | if (size > sequenceLength) 15 | { 16 | error('Sample AVL: Size cannot be larger than sequence length'); 17 | return; 18 | } 19 | float sampleSequence[]; 20 | reize(sampleSequence, sequenceLength); 21 | int selected[]; 22 | reize(selected, sequenceLength); 23 | int index; 24 | for (int i = 0; i < size; ++i) 25 | { 26 | for (float j = 0.1234567; 1; j += 0.01245) 27 | { 28 | index = avl_randrange(0, sequenceLength, i * j * seed); 29 | if (avl_in(selected, selected[i], 0, i)) 30 | { 31 | selected[i] = index; 32 | sampleSequence[i] = sequence[index]; 33 | break; 34 | } 35 | } 36 | } 37 | return sampleSequence; 38 | } 39 | 40 | // Todo (1.0): int avl_sample(const int[]; ...) 41 | 42 | // Todo (1.0): int avl_sample(const string[]; ...) 43 | 44 | // Todo (1.0): int avl_sample(const vector2[]; ...) 45 | 46 | // Todo (1.0): int avl_sample(const vector[]; ...) 47 | 48 | // Todo (1.0): int avl_sample(const vector4[]; ...) 49 | 50 | // Todo (1.0): int avl_sample(const matrix2[]; ...) 51 | 52 | // Todo (1.0): int avl_sample(const matrix3[]; ...) 53 | 54 | // Todo (1.0): int avl_sample(const matrix[]; ...) 55 | 56 | #endif // _AVL_SAMPLE_H_ 57 | -------------------------------------------------------------------------------- /vex/include/avl_vertexnormal.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_VERTEXNORMAL_H_ 3 | #define _AVL_VERTEXNORMAL_H_ 4 | 5 | #include "avl_angle.h" 6 | 7 | vector 8 | avl_vertexnormal(const int geometry; 9 | const int primnum; 10 | const int vtxnum; 11 | const float cuspAngle) 12 | { 13 | int vtxPoint, vtxPrim; 14 | if (primnum == -1) 15 | { 16 | vtxPoint = vertexpoint(geometry, vtxnum); 17 | vtxPrim = vertexprim(geometry, vtxnum); 18 | } 19 | else 20 | { 21 | int linearVtxnum = vertexindex(geometry, primnum, vtxnum); 22 | vtxPoint = vertexpoint(geometry, linearVtxnum); 23 | vtxPrim = vertexprim(geometry, linearVtxnum); 24 | } 25 | int primitives[] = pointprims(geometry, vtxPoint); 26 | vector vtxPrimNormal = prim_normal(geometry, vtxPrim, 0.5, 0.5); 27 | if (len(primitives) == 1) 28 | return vtxPrimNormal; 29 | vector normals = vtxPrimNormal; 30 | int count = 1; 31 | vector normal; 32 | for (int primitive : primitives) 33 | { 34 | if (primitive == vtxPrim) 35 | continue; 36 | normal = prim_normal(geometry, primitive, 0.5, 0.5); 37 | if (degrees(avl_angle(normal, vtxPrimNormal)) <= cuspAngle) 38 | { 39 | normals += normal; 40 | ++count; 41 | } 42 | } 43 | return normalize(normals / count); 44 | } 45 | 46 | vector 47 | avl_vertexnormal(const int geometry; 48 | const int primnum; 49 | const int vtxnum) 50 | { 51 | return avl_vertexnormal(geometry, primnum, vtxnum, 60); 52 | } 53 | 54 | #endif // _AVL_VERTEXNORMAL_H_ 55 | -------------------------------------------------------------------------------- /vex/include/avl_swap.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_SWAP_H_ 3 | #define _AVL_SWAP_H_ 4 | 5 | void 6 | avl_swap(export float variable1; export float variable2) 7 | { 8 | float temp = variable1; 9 | variable1 = variable2; 10 | variable2 = temp; 11 | } 12 | 13 | void 14 | avl_swap(export int variable1; export int variable2) 15 | { 16 | int temp = variable1; 17 | variable1 = variable2; 18 | variable2 = temp; 19 | } 20 | 21 | void 22 | avl_swap(export string variable1; export string variable2) 23 | { 24 | string temp = variable1; 25 | variable1 = variable2; 26 | variable2 = temp; 27 | } 28 | 29 | void 30 | avl_swap(export vector2 variable1; export vector2 variable2) 31 | { 32 | vector2 temp = variable1; 33 | variable1 = variable2; 34 | variable2 = temp; 35 | } 36 | 37 | void 38 | avl_swap(export vector variable1; export vector variable2) 39 | { 40 | vector temp = variable1; 41 | variable1 = variable2; 42 | variable2 = temp; 43 | } 44 | 45 | void 46 | avl_swap(export vector4 variable1; export vector4 variable2) 47 | { 48 | vector4 temp = variable1; 49 | variable1 = variable2; 50 | variable2 = temp; 51 | } 52 | 53 | void 54 | avl_swap(export matrix2 variable1; export matrix2 variable2) 55 | { 56 | matrix2 temp = variable1; 57 | variable1 = variable2; 58 | variable2 = temp; 59 | } 60 | 61 | void 62 | avl_swap(export matrix3 variable1; export matrix3 variable2) 63 | { 64 | matrix3 temp = variable1; 65 | variable1 = variable2; 66 | variable2 = temp; 67 | } 68 | 69 | void 70 | avl_swap(export matrix variable1; export matrix variable2) 71 | { 72 | matrix temp = variable1; 73 | variable1 = variable2; 74 | variable2 = temp; 75 | } 76 | 77 | #endif // _AVL_SWAP_H_ 78 | -------------------------------------------------------------------------------- /vex/include/avl_normalizevalues.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_NORMALIZEVALUES_H_ 3 | #define _AVL_NORMALIZEVALUES_H_ 4 | 5 | vector2 6 | avl_normalizevalues(const vector2 values) 7 | { 8 | return values / sum(values); 9 | } 10 | 11 | vector 12 | avl_normalizevalues(const vector values) 13 | { 14 | return values / sum(values); 15 | } 16 | 17 | vector4 18 | avl_normalizevalues(const vector4 values) 19 | { 20 | return values / sum(values); 21 | } 22 | 23 | float[] 24 | avl_normalizevalues(const float values[]) 25 | { 26 | float newValues[]; 27 | resize(newValues, len(values)); 28 | float total = sum(values); 29 | foreach (int index; float weight; values) 30 | newValues[index] = weight / total; 31 | return newValues; 32 | } 33 | 34 | float[] 35 | avl_normalizevalues(const float values[]; const float scale) 36 | { 37 | float newValues[]; 38 | resize(newValues, len(values)); 39 | float total = sum(values) / scale; 40 | foreach (int index; float weight; values) 41 | newValues[index] = weight / total; 42 | return newValues; 43 | } 44 | 45 | float[] 46 | avl_normalizevalues(const int values[]) 47 | { 48 | float newValues[]; 49 | resize(newValues, len(values)); 50 | float total = sum(values); 51 | foreach (int index; float weight; values) 52 | newValues[index] = weight / total; 53 | return newValues; 54 | } 55 | 56 | float[] 57 | avl_normalizevalues(const int values[]; const float scale) 58 | { 59 | float newValues[]; 60 | resize(newValues, len(values)); 61 | float total = sum(values) / scale; 62 | foreach (int index; float weight; values) 63 | newValues[index] = weight / total; 64 | return newValues; 65 | } 66 | 67 | #endif // _AVL_NORMALIZEVALUES_H_ 68 | -------------------------------------------------------------------------------- /vex/include/avl_inpointbbox.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_INPOINTBBOX_H_ 3 | #define _AVL_INPOINTBBOX_H_ 4 | 5 | int 6 | avl_inpointbbox(const int geometry; const vector position) 7 | { 8 | vector min = getpointbbox_min(geometry); 9 | vector max = getpointbbox_max(geometry); 10 | return position.x > min.x && position.x < max.x && 11 | position.y > min.y && position.y < max.y && 12 | position.z > min.z && position.z < max.z; 13 | } 14 | 15 | int 16 | avl_inpointbbox(const string geometry; const vector position) 17 | { 18 | vector min = getpointbbox_min(geometry); 19 | vector max = getpointbbox_max(geometry); 20 | return position.x > min.x && position.x < max.x && 21 | position.y > min.y && position.y < max.y && 22 | position.z > min.z && position.z < max.z; 23 | } 24 | 25 | int 26 | avl_inpointbbox(const int geometry; 27 | const vector position; 28 | const string pointgroup) 29 | { 30 | vector min = getpointbbox_min(geometry, pointgroup); 31 | vector max = getpointbbox_max(geometry, pointgroup); 32 | return position.x > min.x && position.x < max.x && 33 | position.y > min.y && position.y < max.y && 34 | position.z > min.z && position.z < max.z; 35 | } 36 | 37 | int 38 | avl_inpointbbox(const string geometry; 39 | const vector position; 40 | const string pointgroup) 41 | { 42 | vector min = getpointbbox_min(geometry, pointgroup); 43 | vector max = getpointbbox_max(geometry, pointgroup); 44 | return position.x > min.x && position.x < max.x && 45 | position.y > min.y && position.y < max.y && 46 | position.z > min.z && position.z < max.z; 47 | } 48 | 49 | #endif // _AVL_INPOINTBBOX_H_ 50 | -------------------------------------------------------------------------------- /vex/include/avl_polyarea.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_POLYAREA_H_ 3 | #define _AVL_POLYAREA_H_ 4 | 5 | #include "avl_triarea.h" 6 | 7 | // Todo: (1.1): float avl_polyarea(const vector2 vertices[]) 8 | 9 | // Todo: (1.1): float avl_polyarea(const vector2 vertices[]; const string mode) 10 | 11 | // Todo (2.0): float avl_polyarea(const vector2 ...) 12 | 13 | float 14 | avl_polyarea(const vector vertices[]) 15 | { 16 | int vertexCount = len(vertices); 17 | if (vertexCount == 3) // Triangle 18 | return avl_triarea(vertices); 19 | if (vertexCount < 3) // Not polygon 20 | return 0; 21 | float area = 0; 22 | for (int i = 1; i < vertexCount-1; ++i) 23 | area += avl_triarea(vertices[0], vertices[i], vertices[i+1]); 24 | return area; 25 | } 26 | 27 | float 28 | avl_polyarea(const vector vertices[]; const string mode) 29 | { 30 | int vertexCount = len(vertices); 31 | if (vertexCount == 3) // Triangle 32 | return avl_triarea(vertices); 33 | if (vertexCount < 3) // Not polygon 34 | return 0; 35 | float area = 0; 36 | if (mode == 'convex') 37 | { 38 | for (int i = 1; i < vertexCount-1; ++i) 39 | area += avl_triarea(vertices[0], vertices[i], vertices[i+1]); 40 | return area; 41 | } else if (mode == 'concave') 42 | { 43 | for (int i = 1; i < vertexCount-1; ++i) 44 | { 45 | vector cross = cross(vertices[0] - vertices[i], 46 | vertices[0] - vertices[i+1]); 47 | if (dot(cross, {1, 0.9, 0.8}) >= 0) 48 | area += length(cross); 49 | else 50 | area -= length(cross); 51 | } 52 | return abs(area) * 0.5; 53 | } 54 | } 55 | 56 | // Todo (2.0): float avl_polyarea(const vector ...) 57 | 58 | #endif // _AVL_POLYAREA_H_ 59 | -------------------------------------------------------------------------------- /vex/include/avl_isflat.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_ISFLAT_H_ 3 | #define _AVL_ISFLAT_H_ 4 | 5 | #include "avl_almostequal.h" 6 | 7 | int 8 | avl_isflat(const int geometry; const int primnum) 9 | { 10 | int points = primpoints(geometry, primnum); 11 | int pointCount = len(points); 12 | if (pointCount < 3) return 0; // No polygon 13 | if (pointCount == 3) return 1; // Triangle always flat 14 | vector pos1 = point(geometry, 'P', points[-1]); 15 | vector pos2 = point(geometry, 'P', points[0]); 16 | vector pos3 = point(geometry, 'P', points[1]); 17 | vector ref = cross(pos1 - pos2, pos2 - pos3); 18 | for (int i = 1; i < pointCount-1; ++i) 19 | { 20 | pos1 = point(geometry, 'P', points[i-1]); 21 | pos2 = point(geometry, 'P', points[i]); 22 | pos3 = point(geometry, 'P', points[i+1]); 23 | if (!avl_almostequal(cross(pos1 - pos2, pos2 - pos3), ref)) 24 | return 0; 25 | } 26 | return 1; 27 | } 28 | 29 | int 30 | avl_isflat(const string geometry; const int primnum) 31 | { 32 | int points = primpoints(geometry, primnum); 33 | int pointCount = len(points); 34 | if (pointCount < 3) return 0; // No polygon 35 | if (pointCount == 3) return 1; // Triangle always flat 36 | vector pos1 = point(geometry, 'P', points[-1]); 37 | vector pos2 = point(geometry, 'P', points[0]); 38 | vector pos3 = point(geometry, 'P', points[1]); 39 | vector ref = cross(pos1 - pos2, pos2 - pos3); 40 | for (int i = 1; i < pointCount-1; ++i) 41 | { 42 | pos1 = point(geometry, 'P', points[i-1]); 43 | pos2 = point(geometry, 'P', points[i]); 44 | pos3 = point(geometry, 'P', points[i+1]); 45 | if (!avl_almostequal(cross(pos1 - pos2, pos2 - pos3), ref)) 46 | return 0; 47 | } 48 | return 1; 49 | } 50 | 51 | #endif // _AVL_ISFLAT_H_ 52 | -------------------------------------------------------------------------------- /vex/include/avl_inbbox.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_INBBOX_H_ 3 | #define _AVL_INBBOX_H_ 4 | 5 | int 6 | avl_inbbox(const vector minimum; 7 | const vector maximum; 8 | const vector position) 9 | { 10 | return position.x > minimum.x && position.x < maximum.x && 11 | position.y > minimum.y && position.y < maximum.y && 12 | position.z > minimum.z && position.z < maximum.z; 13 | } 14 | 15 | int 16 | avl_inbbox(const int geometry; const vector position) 17 | { 18 | vector min = getbbox_min(geometry); 19 | vector max = getbbox_max(geometry); 20 | return position.x > min.x && position.x < max.x && 21 | position.y > min.y && position.y < max.y && 22 | position.z > min.z && position.z < max.z; 23 | } 24 | 25 | int 26 | avl_inbbox(const string geometry; const vector position) 27 | { 28 | vector min = getbbox_min(geometry); 29 | vector max = getbbox_max(geometry); 30 | return position.x > min.x && position.x < max.x && 31 | position.y > min.y && position.y < max.y && 32 | position.z > min.z && position.z < max.z; 33 | } 34 | 35 | int 36 | avl_inbbox(const int geometry; 37 | const vector position; 38 | const string primgroup) 39 | { 40 | vector min = getbbox_min(geometry, primgroup); 41 | vector max = getbbox_max(geometry, primgroup); 42 | return position.x > min.x && position.x < max.x && 43 | position.y > min.y && position.y < max.y && 44 | position.z > min.z && position.z < max.z; 45 | } 46 | 47 | int 48 | avl_inbbox(const string geometry; 49 | const vector position; 50 | const string primgroup) 51 | { 52 | vector min = getbbox_min(geometry, primgroup); 53 | vector max = getbbox_max(geometry, primgroup); 54 | return position.x > min.x && position.x < max.x && 55 | position.y > min.y && position.y < max.y && 56 | position.z > min.z && position.z < max.z; 57 | } 58 | 59 | #endif // _AVL_INBBOX_H_ 60 | -------------------------------------------------------------------------------- /vex/include/avl_copyedgegroups.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_COPYEDGEGROUPS_H_ 3 | #define _AVL_COPYEDGEGROUPS_H_ 4 | 5 | #include "avl_edgegroups.h" 6 | #include "avl_copyedgegroup.h" 7 | 8 | void 9 | avl_copyedgegroups(const int geometry; 10 | const int geohandle; 11 | const int srcPtnum0; 12 | const int srcPtnum1; 13 | const int dstPtnum0; 14 | const int dstPtnum1) 15 | { 16 | for (string groupName : avl_edgegroups(geometry)) 17 | avl_copyedgegroup(geometry, geohandle, 18 | srcPtnum0, srcPtnum1, 19 | dstPtnum0, dstPtnum1, 20 | groupName); 21 | } 22 | 23 | void 24 | avl_copyedgegroups(const int geometry; 25 | const int geohandle; 26 | const int srcPtnum0; 27 | const int srcPtnum1; 28 | const int dstPtnum0; 29 | const int dstPtnum1; 30 | const string mode) 31 | { 32 | for (string groupName : avl_edgegroups(geometry)) 33 | avl_copyedgegroup(geometry, geohandle, 34 | srcPtnum0, srcPtnum1, 35 | dstPtnum0, dstPtnum1, 36 | groupName, mode); 37 | } 38 | 39 | void 40 | avl_copyedgegroups(const int geometry; 41 | const int geohandle; 42 | const int srcPtnum0; 43 | const int srcPtnum1; 44 | const int dstPtnum0; 45 | const int dstPtnum1; 46 | const string mode; 47 | const string pattern) 48 | { 49 | for (string groupName : avl_edgegroups(geometry)) 50 | if (match(pattern, groupName)) 51 | avl_copyedgegroup(geometry, geohandle, 52 | srcPtnum0, srcPtnum1, 53 | dstPtnum0, dstPtnum1, 54 | groupName, mode); 55 | } 56 | 57 | #endif // _AVL_COPYEDGEGROUPS_H_ 58 | -------------------------------------------------------------------------------- /vex/include/avl_range.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_RANGE_H_ 3 | #define _AVL_RANGE_H_ 4 | 5 | float[] 6 | avl_range(const float start; 7 | const float end; 8 | const float step) 9 | { 10 | float newArray[]; 11 | int index = 0; 12 | if (step > 0) 13 | { 14 | resize(newArray, int(ceil((end - start) / float(step)))); 15 | for (float value = start; value < end; value += step) 16 | newArray[index++] = value; 17 | } else if (step < 0) 18 | { 19 | resize(newArray, int(ceil(abs((end - start) / float(step))))); 20 | for (float value = start; value > end; value += step) 21 | newArray[index++] = value; 22 | } else 23 | { 24 | error('Range AVL: Step argument must not be 0'); 25 | } 26 | return newArray; 27 | } 28 | 29 | float[] 30 | avl_range(const float start; const float end) 31 | { 32 | if (end > start) 33 | return avl_range(start, end, 1); 34 | else 35 | return avl_range(start, end, -1); 36 | } 37 | 38 | float[] 39 | avl_range(const float end) 40 | { 41 | return avl_range(0, end, 1); 42 | } 43 | 44 | int[] 45 | avl_range(const int start; 46 | const int end; 47 | const int step) 48 | { 49 | int newArray[]; 50 | int index = 0; 51 | if (step > 0) 52 | { 53 | resize(newArray, int(ceil((end - start) / float(step)))); 54 | for (int value = start; value < end; value += step) 55 | newArray[index++] = value; 56 | } else if (step < 0) 57 | { 58 | resize(newArray, int(ceil(abs((end - start) / float(step))))); 59 | for (int value = start; value > end; value += step) 60 | newArray[index++] = value; 61 | } else 62 | { 63 | error('Range AVL: Step argument must not be 0'); 64 | } 65 | return newArray; 66 | } 67 | 68 | int[] 69 | avl_range(const int start; const int end) 70 | { 71 | if (end > start) 72 | return avl_range(start, end, 1); 73 | else 74 | return avl_range(start, end, -1); 75 | } 76 | 77 | int[] 78 | avl_range(const int end) 79 | { 80 | return avl_range(0, end, 1); 81 | } 82 | 83 | #endif // _AVL_RANGE_H_ 84 | -------------------------------------------------------------------------------- /vex/include/avl_almostequal.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_ALMOSTEQUAL_H_ 3 | #define _AVL_ALMOSTEQUAL_H_ 4 | 5 | #include 6 | 7 | int 8 | avl_almostequal(const float value1; const float value2) 9 | { 10 | return abs(value1 - value2) <= M_TOLERANCE; 11 | } 12 | 13 | int 14 | avl_almostequal(const float value1; 15 | const float value2; 16 | const float tolerance) 17 | { 18 | return abs(value1 - value2) <= tolerance; 19 | } 20 | 21 | int 22 | avl_almostequal(const int value1; 23 | const int value2; 24 | const int tolerance) 25 | { 26 | return abs(value1 - value2) <= tolerance; 27 | } 28 | 29 | // Todo (1.1): int avl_almostequal(const string; const string; const int) 30 | 31 | // Todo (1.1): int avl_almostequal(const string; const string; const string|int; const int) 32 | 33 | int 34 | avl_almostequal(const vector2 value1; const vector2 value2) 35 | { 36 | return distance2(value1, value2) <= M_TOLERANCE * M_TOLERANCE; 37 | } 38 | 39 | int 40 | avl_almostequal(const vector2 value1; 41 | const vector2 value2; 42 | const float tolerance) 43 | { 44 | return distance2(value1, value2) <= tolerance * tolerance; 45 | } 46 | 47 | int 48 | avl_almostequal(const vector value1; const vector value2) 49 | { 50 | return distance2(value1, value2) <= M_TOLERANCE * M_TOLERANCE; 51 | } 52 | 53 | int 54 | avl_almostequal(const vector value1; 55 | const vector value2; 56 | const float tolerance) 57 | { 58 | return distance2(value1, value2) <= tolerance * tolerance; 59 | } 60 | 61 | int 62 | avl_almostequal(const vector4 value1; const vector4 value2) 63 | { 64 | return qdistance(value1, value2) <= M_TOLERANCE; 65 | } 66 | 67 | int 68 | avl_almostequal(const vector4 value1; 69 | const vector4 value2; 70 | const float tolerance) 71 | { 72 | return qdistance(value1, value2) <= tolerance; 73 | } 74 | 75 | // Todo (1.2): int avl_almostequal(const matrix2; const matrix2; const vector2; const float) 76 | 77 | // Todo (1.2): int avl_almostequal(const matrix3; const matrix3; const vector; const float) 78 | 79 | // Todo (1.2): int avl_almostequal(const matrix; const matrix; const vector; const float) 80 | 81 | #endif // _AVL_ALMOSTEQUAL_H_ 82 | -------------------------------------------------------------------------------- /vex/include/avl_polycentroid.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_POLYCENTROID_H_ 3 | #define _AVL_POLYCENTROID_H_ 4 | 5 | #include "avl_tricentroid.h" 6 | #include "avl_triarea.h" 7 | #include "avl_polyperimeter.h" 8 | 9 | // Todo: optimize 10 | 11 | // Todo (1.0): vector2 avl_polycentroid(const vector2[]) 12 | 13 | // Todo (1.0): vector2 avl_polycentroid(const vector2[]; const string mode) 14 | 15 | // Todo (1.0): vector avl_polycentroid(const vector[]) 16 | 17 | // Todo (2.0): vector2 avl_polycentroid(const vector2 ...) 18 | 19 | vector 20 | avl_polycentroid(const vector vertices[]; const string mode) 21 | { 22 | int vertexCount = len(vertices); 23 | if (vertexCount == 3) // Triangle 24 | return avl_tricentroid(vertices); 25 | if (vertexCount < 3) // Not polygon 26 | return {0, 0, 0}; 27 | if (mode == 'corners') 28 | return avg(vertices); 29 | else if (mode == 'edges') 30 | { 31 | vector centroid = {0, 0, 0}; 32 | float perimeter2 = avl_polyperimeter(vertices);// 33 | vector pos1, pos2; 34 | for (int i = 0; i < vertexCount; ++i) 35 | { 36 | pos1 = vertices[i-1]; 37 | pos2 = vertices[i]; 38 | centroid += ((pos1 + pos2) / 2) * (distance2(pos1, pos2) / perimeter2); 39 | } 40 | return centroid; 41 | } else if (mode == 'areas') 42 | { 43 | vector centroid = {0, 0, 0}; 44 | float area = avl_polyarea(0, 0);// 45 | vector pos0 = vertices[0]; 46 | vector pos1, pos2; 47 | for (int i = 1; i < vertexCount-1; ++i) 48 | { 49 | pos1 = vertices[i]; 50 | pos2 = vertices[i+1]; 51 | vector cross = cross(pos0-pos1, pos0-pos2); 52 | if (dot(cross, {1, 0.9, 0.8}) >= 0) 53 | centroid += avl_tricentroid(pos0, pos1, pos2) * 54 | (avl_triarea(pos0, pos1, pos2) / area); 55 | else 56 | centroid -= avl_tricentroid(pos0, pos1, pos2) * 57 | (avl_triarea(pos0, pos1, pos2) / area); 58 | } 59 | return abs(centroid); 60 | } else 61 | { 62 | error('Polygon Centroid AVL: Unknown mode ' + mode); 63 | return {0, 0, 0}; 64 | } 65 | } 66 | 67 | // Todo (2.0): vector avl_polycentroid(const vector ...) 68 | 69 | #endif // _AVL_POLYCENTROID_H_ 70 | -------------------------------------------------------------------------------- /vex/include/avl_round.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_ROUND_H_ 3 | #define _AVL_ROUND_H_ 4 | 5 | float 6 | avl_round(const float value; const int ndigits) 7 | { 8 | float shift = pow(10, ndigits); 9 | return rint(value * shift) / shift; 10 | } 11 | 12 | int 13 | avl_round(const int value; const int ndigits) 14 | { 15 | float shift = (int)pow(10, abs(ndigits)); 16 | return int(rint(value / shift) * shift); 17 | } 18 | 19 | vector2 20 | avl_round(const vector2 value; const int ndigits) 21 | { 22 | float shift = pow(10, ndigits); 23 | return rint(value * shift) / shift; 24 | } 25 | 26 | vector 27 | avl_round(const vector value; const int ndigits) 28 | { 29 | float shift = pow(10, ndigits); 30 | return rint(value * shift) / shift; 31 | } 32 | 33 | vector4 34 | avl_round(const vector4 value; const int ndigits) 35 | { 36 | float shift = pow(10, ndigits); 37 | return rint(value * shift) / shift; 38 | } 39 | 40 | float[] 41 | avl_round(const float values[]; const int ndigits) 42 | { 43 | float newValues[]; 44 | resize(newValues, len(values)); 45 | foreach(int index; float value; values) 46 | newValues[index] = avl_round(value, ndigits); 47 | return newValues; 48 | } 49 | 50 | int[] 51 | avl_round(const int values[]; const int ndigits) 52 | { 53 | int newValues[]; 54 | resize(newValues, len(values)); 55 | foreach(int index; int value; values) 56 | newValues[index] = avl_round(value, ndigits); 57 | return newValues; 58 | } 59 | 60 | vector2[] 61 | avl_round(const vector2 values[]; const int ndigits) 62 | { 63 | vector2 newValues[]; 64 | resize(newValues, len(values)); 65 | foreach(int index; vector2 value; values) 66 | newValues[index] = avl_round(value, ndigits); 67 | return newValues; 68 | } 69 | 70 | vector[] 71 | avl_round(const vector values[]; const int ndigits) 72 | { 73 | vector newValues[]; 74 | resize(newValues, len(values)); 75 | foreach(int index; vector value; values) 76 | newValues[index] = avl_round(value, ndigits); 77 | return newValues; 78 | } 79 | 80 | vector4[] 81 | avl_round(const vector4 values[]; const int ndigits) 82 | { 83 | vector4 newValues[]; 84 | resize(newValues, len(values)); 85 | foreach(int index; vector4 value; values) 86 | newValues[index] = avl_round(value, ndigits); 87 | return newValues; 88 | } 89 | 90 | #endif // _AVL_ROUND_H_ 91 | -------------------------------------------------------------------------------- /help/vex/avl.txt: -------------------------------------------------------------------------------- 1 | = Advanced VEX Library = 2 | 3 | #icon: NETWORKS/vop 4 | 5 | """Functions, nodes, and tools that extend the capabilities of the VEX language.""" 6 | 7 | == Overview == 8 | 9 | === Help === 10 | 11 | The search box in the top right of every Houdini help page lets you search the help. You can use `!av` shortcut to search AVL docs only: 12 | {{{ 13 | !av whatyouwant 14 | }}} 15 | 16 | === Intergration === 17 | 18 | Тут рассказать про присутствие в главном меню 19 | 20 | Пунктах меню на вранглах различных контекстов 21 | 22 | Пунктах на любых VOP AVL нодах для преобразования в snippet 23 | 24 | === Roadmap === 25 | 26 | AVL 1.0 <<(Current)>>: 27 | 28 | Geometric and Math Functions <<(VEX, VOP+Python)>> 29 | 30 | Pixel Wrangle COP2 (Preview) <<(COP2+Python)>> 31 | 32 | VEX Shell (Preview) <<(Python+VEX)>> 33 | 34 | AVL 1.1: 35 | 36 | Shaders and Shader Patterns <<(VEX, VOP+GLSL)>> 37 | 38 | Pixel Wrangle COP2 (Release) 39 | 40 | Transformation Wrangle OBJ (Preview) <<(Python)>> 41 | 42 | VEX Shell (Release) 43 | 44 | AVL 1.2: 45 | 46 | Transformation Wrangle OBJ (Release) 47 | 48 | Attribute Wrangle GPU SOP (Preview) <<(Python+OpenCL)>> 49 | 50 | VEX Optimizer (Preview) <<(Python)>> 51 | 52 | AVL 1.3: 53 | 54 | Attribute Wrangle GPU SOP (Release) 55 | 56 | VEX Optimizer (Release) 57 | 58 | Deployment Tool (Preview) <<(Python)>> 59 | 60 | VEX Code Editor (Preview) <<(Python)>> 61 | 62 | AVL 1.4: 63 | 64 | Deployment Tool (Release) 65 | 66 | VEX Code Editor (Release) 67 | 68 | AVL 2.0: 69 | 70 | <> 71 | 72 | == Tools == 73 | 74 | [VEX Shell|avl_vex_shell] 75 | 76 | [VEX Optimizer|avl_vex_optimizer] 77 | 78 | [VEX Deployment Tool|avl_deployment] 79 | 80 | [VEX Code Editor|avl_code_editor] 81 | 82 | == Nodes == 83 | 84 | === Wranglers === 85 | 86 | [Attribute Wrangle GPU SOP|Node:sop/avl--attribwranglegpu-1.0] 87 | 88 | [Transformation Wrangle OBJ|Node:obj/avl--xformwrangle-1.0] 89 | 90 | [Pixel Wrangle COP2|Node:cop2/avl--pixelwrangle-1.0] 91 | 92 | === VOPs === 93 | 94 | :list: 95 | #query: type:node context:vop tags:avl 96 | #sortedby: title 97 | #display: show-icons columns 98 | 99 | == Functions == 100 | 101 | :list: 102 | #query: category:vex tags:avl 103 | #sortedby: title 104 | #groupedby: group 105 | #labels: functions/_groups_en.ini 106 | -------------------------------------------------------------------------------- /vex/include/avl_choice.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_CHOICE_H_ 3 | #define _AVL_CHOICE_H_ 4 | 5 | #include "avl_randrange.h" 6 | 7 | float 8 | avl_choice(const float sequence[]; const float seed) 9 | { 10 | sequenceLength = len(sequence); 11 | if (sequenceLength == 0) 12 | error('Choice AVL: Sequence cannot be empty'); 13 | return sequence[avl_randrange(seed, 0, sequenceLength)]; 14 | } 15 | 16 | int 17 | avl_choice(const int sequence[]; const float seed) 18 | { 19 | sequenceLength = len(sequence); 20 | if (sequenceLength == 0) 21 | error('Choice AVL: Sequence cannot be empty'); 22 | return sequence[avl_randrange(seed, 0, sequenceLength)]; 23 | } 24 | 25 | string 26 | avl_choice(const string sequence[]; const float seed) 27 | { 28 | sequenceLength = len(sequence); 29 | if (sequenceLength == 0) 30 | error('Choice AVL: Sequence cannot be empty'); 31 | return sequence[avl_randrange(seed, 0, sequenceLength)]; 32 | } 33 | 34 | vector2 35 | avl_choice(const vector2 sequence[]; const float seed) 36 | { 37 | sequenceLength = len(sequence); 38 | if (sequenceLength == 0) 39 | error('Choice AVL: Sequence cannot be empty'); 40 | return sequence[avl_randrange(seed, 0, sequenceLength)]; 41 | } 42 | 43 | vector 44 | avl_choice(const vector sequence[]; const float seed) 45 | { 46 | sequenceLength = len(sequence); 47 | if (sequenceLength == 0) 48 | error('Choice AVL: Sequence cannot be empty'); 49 | return sequence[avl_randrange(seed, 0, sequenceLength)]; 50 | } 51 | 52 | vector4 53 | avl_choice(const vector4 sequence[]; const float seed) 54 | { 55 | sequenceLength = len(sequence); 56 | if (sequenceLength == 0) 57 | error('Choice AVL: Sequence cannot be empty'); 58 | return sequence[avl_randrange(seed, 0, sequenceLength)]; 59 | } 60 | 61 | matrix2 62 | avl_choice(const matrix2 sequence[]; const float seed) 63 | { 64 | sequenceLength = len(sequence); 65 | if (sequenceLength == 0) 66 | error('Choice AVL: Sequence cannot be empty'); 67 | return sequence[avl_randrange(seed, 0, sequenceLength)]; 68 | } 69 | 70 | matrix3 71 | avl_choice(const matrix3 sequence[]; const float seed) 72 | { 73 | sequenceLength = len(sequence); 74 | if (sequenceLength == 0) 75 | error('Choice AVL: Sequence cannot be empty'); 76 | return sequence[avl_randrange(seed, 0, sequenceLength)]; 77 | } 78 | 79 | matrix 80 | avl_choice(const matrix sequence[]; const float seed) 81 | { 82 | sequenceLength = len(sequence); 83 | if (sequenceLength == 0) 84 | error('Choice AVL: Sequence cannot be empty'); 85 | return sequence[avl_randrange(seed, 0, sequenceLength)]; 86 | } 87 | 88 | #endif // _AVL_CHOICE_H_ 89 | -------------------------------------------------------------------------------- /vex/include/avl_polyneighbours.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_POLYNEIGHBOURS_H_ 3 | #define _AVL_POLYNEIGHBOURS_H_ 4 | 5 | #include "avl_unique.h" 6 | 7 | int[] 8 | avl_polyneighbours(const int geometry; 9 | const int primnum; 10 | const int byPoints) 11 | { 12 | int primitives[]; 13 | if (byPoints == 0) 14 | { 15 | int startHedge = primhedge(geometry, primnum); 16 | int hedge = startHedge; 17 | while (hedge != -1) 18 | { 19 | for (int nextHedge = hedge_nextequiv(geometry, hedge); 20 | nextHedge != hedge; 21 | nextHedge = hedge_nextequiv(geometry, nextHedge)) 22 | { 23 | int prim = hedge_prim(geometry, nextHedge); 24 | if (prim != -1 && prim != primnum) 25 | { 26 | append(primitives, prim); 27 | } 28 | } 29 | hedge = hedge_next(geometry, hedge); 30 | if (hedge == startHedge) 31 | break; 32 | } 33 | } else { 34 | for (int pt : primpoints(geometry, primnum)) 35 | { 36 | push(primitives, pointprims(geometry, pt)); 37 | } 38 | primitives = avl_unique(sort(primitives)); 39 | removevalue(primitives, primnum); 40 | } 41 | return primitives; 42 | } 43 | 44 | int[] 45 | avl_polyneighbours(const int geometry; 46 | const int primnum) 47 | { 48 | return avl_polyneighbours(geometry, primnum, 1); 49 | } 50 | 51 | int[] 52 | avl_polyneighbours(const string geometry; 53 | const int primnum; 54 | const int byPoints) 55 | { 56 | int primitives[]; 57 | if (byPoints == 0) 58 | { 59 | int startHedge = primhedge(geometry, primnum); 60 | int hedge = startHedge; 61 | while (hedge != -1) 62 | { 63 | for (int nextHedge = hedge_nextequiv(geometry, hedge); 64 | nextHedge != hedge; 65 | nextHedge = hedge_nextequiv(geometry, nextHedge)) 66 | { 67 | int prim = hedge_prim(geometry, nextHedge); 68 | if (prim != -1 && prim != primnum) 69 | { 70 | append(primitives, prim); 71 | } 72 | } 73 | hedge = hedge_next(geometry, hedge); 74 | if (hedge == startHedge) 75 | break; 76 | } 77 | } else { 78 | for (int pt : primpoints(geometry, primnum)) 79 | { 80 | push(primitives, pointprims(geometry, pt)); 81 | } 82 | primitives = avl_unique(sort(primitives)); 83 | removevalue(primitives, primnum); 84 | } 85 | return primitives; 86 | } 87 | 88 | int[] 89 | avl_polyneighbours(const string geometry; 90 | const int primnum) 91 | { 92 | return avl_polyneighbours(geometry, primnum, 1); 93 | } 94 | 95 | #endif // _AVL_POLYNEIGHBOURS_H_ 96 | -------------------------------------------------------------------------------- /vex/include/avl_copyprim.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_COPYPRIM_H_ 3 | #define _AVL_COPYPRIM_H_ 4 | 5 | #include "avl_primtype.h" 6 | #include "avl_copypoint.h" 7 | #include "avl_copyprimattribs.h" 8 | #include "avl_copyprimgroups.h" 9 | 10 | int 11 | avl_copyprim(const int geohandle; const int primnum) 12 | { 13 | int primitiveType = avl_primtype(geohandle, primnum); 14 | if (primitiveType != AVL_PRIMTYPE_POLY) // Unsupported type of primitive 15 | return -1; 16 | int primitiveCopy; 17 | if (avl_isclosed(geohandle, primnum)) 18 | primitiveCopy = addprim(geohandle, 'poly'); 19 | else 20 | primitiveCopy = addprim(geohandle, 'polyline'); 21 | int sourcePoints[] = primpoints(geohandle, primnum); 22 | int newPoint; 23 | for (int sourcePoint : sourcePoints) 24 | { 25 | newPoint = avl_copypoint(geohandle, sourcePoint); 26 | addvertex(geohandle, primitiveCopy, newPoint); 27 | } 28 | avl_copyprimattribs(geohandle, geohandle, primnum, primitiveCopy); 29 | avl_copyprimgroups(geohandle, geohandle, primnum, primitiveCopy); 30 | return primitiveCopy; 31 | } 32 | 33 | int 34 | avl_copyprim(const int geometry; 35 | const int geohandle; 36 | const int primnum) 37 | { 38 | int primitiveType = avl_primtype(geohandle, primnum); 39 | if (primitiveType != AVL_PRIMTYPE_POLY) // Unsupported type of primitive 40 | return -1; 41 | int primitiveCopy; 42 | if (avl_isclosed(geohandle, primnum)) 43 | primitiveCopy = addprim(geohandle, 'poly'); 44 | else 45 | primitiveCopy = addprim(geohandle, 'polyline'); 46 | int sourcePoints[] = primpoints(geohandle, primnum); 47 | int newPoint; 48 | for (int sourcePoint : sourcePoints) 49 | { 50 | newPoint = avl_copypoint(geometry,geohandle, sourcePoint); 51 | addvertex(geohandle, primitiveCopy, newPoint); 52 | } 53 | avl_copyprimattribs(geometry, geohandle, primnum, primitiveCopy); 54 | avl_copyprimgroups(geometry, geohandle, primnum, primitiveCopy); 55 | return primitiveCopy; 56 | } 57 | 58 | int 59 | avl_copyprim(const string geometry; 60 | const int geohandle; 61 | const int primnum) 62 | { 63 | int primitiveType = avl_primtype(geohandle, primnum); 64 | if (primitiveType != AVL_PRIMTYPE_POLY) // Unsupported type of primitive 65 | return -1; 66 | int primitiveCopy; 67 | if (avl_isclosed(geohandle, primnum)) 68 | primitiveCopy = addprim(geohandle, 'poly'); 69 | else 70 | primitiveCopy = addprim(geohandle, 'polyline'); 71 | int sourcePoints[] = primpoints(geohandle, primnum); 72 | int newPoint; 73 | for (int sourcePoint : sourcePoints) 74 | { 75 | newPoint = avl_copypoint(geometry,geohandle, sourcePoint); 76 | addvertex(geohandle, primitiveCopy, newPoint); 77 | } 78 | avl_copyprimattribs(geometry, geohandle, primnum, primitiveCopy); 79 | avl_copyprimgroups(geometry, geohandle, primnum, primitiveCopy); 80 | return primitiveCopy; 81 | } 82 | 83 | #endif // _AVL_COPYPRIM_H_ 84 | -------------------------------------------------------------------------------- /vex/include/avl_unique.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_UNIQUE_H_ 3 | #define _AVL_UNIQUE_H_ 4 | 5 | float[] 6 | avl_unique(const float sequence[]) 7 | { 8 | float uniqueSequence[]; 9 | append(uniqueSequence, sequence[0]); 10 | for (int i = 1; i < len(sequence); ++i) 11 | if (sequence[i] != sequence[i-1]) 12 | append(uniqueSequence, sequence[i]); 13 | return uniqueSequence; 14 | } 15 | 16 | int[] 17 | avl_unique(const int sequence[]) 18 | { 19 | int uniqueSequence[]; 20 | append(uniqueSequence, sequence[0]); 21 | for (int i = 1; i < len(sequence); ++i) 22 | if (sequence[i] != sequence[i-1]) 23 | append(uniqueSequence, sequence[i]); 24 | return uniqueSequence; 25 | } 26 | 27 | string[] 28 | avl_unique(const string sequence[]) 29 | { 30 | string uniqueSequence[]; 31 | append(uniqueSequence, sequence[0]); 32 | for (int i = 1; i < len(sequence); ++i) 33 | if (sequence[i] != sequence[i-1]) 34 | append(uniqueSequence, sequence[i]); 35 | return uniqueSequence; 36 | } 37 | 38 | vector2[] 39 | avl_unique(const vector2 sequence[]) 40 | { 41 | vector2 uniqueSequence[]; 42 | append(uniqueSequence, sequence[0]); 43 | for (int i = 1; i < len(sequence); ++i) 44 | if (sequence[i] != sequence[i-1]) 45 | append(uniqueSequence, sequence[i]); 46 | return uniqueSequence; 47 | } 48 | 49 | vector[] 50 | avl_unique(const vector sequence[]) 51 | { 52 | vector uniqueSequence[]; 53 | append(uniqueSequence, sequence[0]); 54 | for (int i = 1; i < len(sequence); ++i) 55 | if (sequence[i] != sequence[i-1]) 56 | append(uniqueSequence, sequence[i]); 57 | return uniqueSequence; 58 | } 59 | 60 | vector4[] 61 | avl_unique(const vector4 sequence[]) 62 | { 63 | vector4 uniqueSequence[]; 64 | append(uniqueSequence, sequence[0]); 65 | for (int i = 1; i < len(sequence); ++i) 66 | if (sequence[i] != sequence[i-1]) 67 | append(uniqueSequence, sequence[i]); 68 | return uniqueSequence; 69 | } 70 | 71 | matrix2[] 72 | avl_unique(const matrix2 sequence[]) 73 | { 74 | matrix2 uniqueSequence[]; 75 | append(uniqueSequence, sequence[0]); 76 | for (int i = 1; i < len(sequence); ++i) 77 | if (sequence[i] != sequence[i-1]) 78 | append(uniqueSequence, sequence[i]); 79 | return uniqueSequence; 80 | } 81 | 82 | matrix3[] 83 | avl_unique(const matrix3 sequence[]) 84 | { 85 | matrix3 uniqueSequence[]; 86 | append(uniqueSequence, sequence[0]); 87 | for (int i = 1; i < len(sequence); ++i) 88 | if (sequence[i] != sequence[i-1]) 89 | append(uniqueSequence, sequence[i]); 90 | return uniqueSequence; 91 | } 92 | 93 | matrix[] 94 | avl_unique(const matrix sequence[]) 95 | { 96 | matrix uniqueSequence[]; 97 | append(uniqueSequence, sequence[0]); 98 | for (int i = 1; i < len(sequence); ++i) 99 | if (sequence[i] != sequence[i-1]) 100 | append(uniqueSequence, sequence[i]); 101 | return uniqueSequence; 102 | } 103 | 104 | #endif // _AVL_UNIQUE_H_ 105 | -------------------------------------------------------------------------------- /vex/include/avl_in.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_IN_H_ 3 | #define _AVL_IN_H_ 4 | 5 | // Todo: negative indices support, reverse search 6 | 7 | #include 8 | 9 | #include "avl_almostequal.h" 10 | 11 | int 12 | avl_in(const float sequence[]; const float value) 13 | { 14 | for (float itemValue : sequence) 15 | if (avl_almostequal(itemValue, value, M_TOLERANCE)) 16 | return 1; 17 | return 0; 18 | } 19 | 20 | int 21 | avl_in(const float sequence[]; 22 | const float value; 23 | const int start) 24 | { 25 | int sequenceLength = len(sequence); 26 | if (start >= sequenceLength) // Todo: comment 27 | { 28 | error('In AVL: Start cannot be greater or equal than sequence length'); 29 | return; 30 | } 31 | for (int i = start; start < sequenceLength; ++i) 32 | if (avl_almostequal(sequence[i], value, M_TOLERANCE)) 33 | return 1; 34 | return 0; 35 | } 36 | 37 | int 38 | avl_in(const float sequence[]; 39 | const float value; 40 | const int start; 41 | const int end) 42 | { 43 | int sequenceLength = len(sequence); 44 | if (start >= end && end >= sequenceLength) // Todo: comment 45 | { 46 | error('In AVL: todo'); // Todo: error message 47 | return; 48 | } 49 | for (int i = start; start < end; ++i) 50 | if (avl_almostequal(sequence[i], value, M_TOLERANCE)) 51 | return 1; 52 | return 0; 53 | } 54 | 55 | int 56 | avl_in(const float sequence[]; 57 | const float value; 58 | const float tolerance) 59 | { 60 | for (float itemValue : sequence) 61 | if (avl_almostequal(itemValue, value, tolerance)) 62 | return 1; 63 | return 0; 64 | } 65 | 66 | int 67 | avl_in(const float sequence[]; 68 | const float value; 69 | const float tolerance; 70 | const int start; 71 | const int end) 72 | { 73 | int sequenceLength = len(sequence); 74 | if (start >= end && end >= sequenceLength) // Todo: comment 75 | { 76 | error('In AVL: todo'); // Todo: error message 77 | return; 78 | } 79 | for (int i = start; start < end; ++i) 80 | if (avl_almostequal(sequence[i], value, tolerance)) 81 | return 1; 82 | return 0; 83 | } 84 | 85 | int 86 | avl_in(const int sequence[]; const int value) 87 | { 88 | return find(sequence, value) >= 0; 89 | } 90 | 91 | int 92 | avl_in(const int sequence[]; 93 | const int value; 94 | const int start) 95 | { 96 | return find(sequence, value, start) >= 0; 97 | } 98 | 99 | int 100 | avl_in(const int sequence[]; 101 | const int value; 102 | const int start; 103 | const int end) 104 | { 105 | return find(sequence, value, start, end) >= 0; 106 | } 107 | 108 | // Todo (1.0): int avl_in(const string; string; ...) 109 | 110 | // Todo (1.0): int avl_in(const string[]; string; ...) 111 | 112 | // Todo (1.0): int avl_in(const vector2[]; vector2; ...) 113 | 114 | // Todo (1.0): int avl_in(const vector[]; vector; ...) 115 | 116 | // Todo (1.0): int avl_in(const vector4[]; vector4; ...) 117 | 118 | #endif // _AVL_IN_H_ 119 | -------------------------------------------------------------------------------- /OPmenu.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 19 | 20 | 34 | 35 | 49 | 50 | 64 | 65 | 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /vex/include/avl_shift.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_SHIFT_H_ 3 | #define _AVL_SHIFT_H_ 4 | 5 | float[] 6 | avl_shift(const float sequence[]; const int shift) 7 | { 8 | int sequenceLength = len(sequence); 9 | float shiftedSequence[]; 10 | resize(shiftedSequence, sequenceLength); 11 | for (int i = 0; i < sequenceLength; ++i) 12 | shiftedSequence[(i + shift) % sequenceLength] = sequence[i]; 13 | return shiftedSequence; 14 | } 15 | 16 | int[] 17 | avl_shift(const int sequence[]; const int shift) 18 | { 19 | int sequenceLength = len(sequence); 20 | int shiftedSequence[]; 21 | resize(shiftedSequence, sequenceLength); 22 | for (int i = 0; i < sequenceLength; ++i) 23 | shiftedSequence[(i + shift) % sequenceLength] = sequence[i]; 24 | return shiftedSequence; 25 | } 26 | 27 | string[] 28 | avl_shift(const string sequence[]; const int shift) 29 | { 30 | int sequenceLength = len(sequence); 31 | string shiftedSequence[]; 32 | resize(shiftedSequence, sequenceLength); 33 | for (int i = 0; i < sequenceLength; ++i) 34 | shiftedSequence[(i + shift) % sequenceLength] = sequence[i]; 35 | return shiftedSequence; 36 | } 37 | 38 | vector2[] 39 | avl_shift(const vector2 sequence[]; const int shift) 40 | { 41 | int sequenceLength = len(sequence); 42 | vector2 shiftedSequence[]; 43 | resize(shiftedSequence, sequenceLength); 44 | for (int i = 0; i < sequenceLength; ++i) 45 | shiftedSequence[(i + shift) % sequenceLength] = sequence[i]; 46 | return shiftedSequence; 47 | } 48 | 49 | vector[] 50 | avl_shift(const vector sequence[]; const int shift) 51 | { 52 | int sequenceLength = len(sequence); 53 | vector shiftedSequence[]; 54 | resize(shiftedSequence, sequenceLength); 55 | for (int i = 0; i < sequenceLength; ++i) 56 | shiftedSequence[(i + shift) % sequenceLength] = sequence[i]; 57 | return shiftedSequence; 58 | } 59 | 60 | vector4[] 61 | avl_shift(const vector4 sequence[]; const int shift) 62 | { 63 | int sequenceLength = len(sequence); 64 | vector4 shiftedSequence[]; 65 | resize(shiftedSequence, sequenceLength); 66 | for (int i = 0; i < sequenceLength; ++i) 67 | shiftedSequence[(i + shift) % sequenceLength] = sequence[i]; 68 | return shiftedSequence; 69 | } 70 | 71 | matrix2[] 72 | avl_shift(const matrix2 sequence[]; const int shift) 73 | { 74 | int sequenceLength = len(sequence); 75 | matrix2 shiftedSequence[]; 76 | resize(shiftedSequence, sequenceLength); 77 | for (int i = 0; i < sequenceLength; ++i) 78 | shiftedSequence[(i + shift) % sequenceLength] = sequence[i]; 79 | return shiftedSequence; 80 | } 81 | 82 | matrix3[] 83 | avl_shift(const matrix3 sequence[]; const int shift) 84 | { 85 | int sequenceLength = len(sequence); 86 | matrix3 shiftedSequence[]; 87 | resize(shiftedSequence, sequenceLength); 88 | for (int i = 0; i < sequenceLength; ++i) 89 | shiftedSequence[(i + shift) % sequenceLength] = sequence[i]; 90 | return shiftedSequence; 91 | } 92 | 93 | matrix[] 94 | avl_shift(const matrix sequence[]; const int shift) 95 | { 96 | int sequenceLength = len(sequence); 97 | matrix shiftedSequence[]; 98 | resize(shiftedSequence, sequenceLength); 99 | for (int i = 0; i < sequenceLength; ++i) 100 | shiftedSequence[(i + shift) % sequenceLength] = sequence[i]; 101 | return shiftedSequence; 102 | } 103 | 104 | #endif // _AVL_SHIFT_H_ 105 | -------------------------------------------------------------------------------- /MainMenuCommon.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 14 | 15 | 22 | 23 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 41 | 42 | 47 | 48 | 53 | 54 | 55 | 56 | 61 | 62 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | import webbrowser 74 | 75 | repoURL = 'https://github.com/AdvancedVEXLibrary/Advanced-VEX-Library' 76 | webbrowser.open_new_tab(repoURL) 77 | 78 | 79 | 80 | 85 | 86 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | from avl import version 98 | 99 | hou.ui.displayMessage('Version ' + version, title='About AVL') 100 | 101 | 102 | 103 | 104 | 105 | 106 | -------------------------------------------------------------------------------- /vex/include/avl_count.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_COUNT_H_ 3 | #define _AVL_COUNT_H_ 4 | 5 | int 6 | avl_count(const string haystack; const string needle) 7 | { 8 | int count = 0; 9 | int offset = len(needle); 10 | int index = 0; 11 | while (1) 12 | { 13 | index = find(haystack, needle, index + offset); 14 | if (index > -1) 15 | ++count; 16 | else 17 | break; 18 | } 19 | return count; 20 | } 21 | 22 | int 23 | avl_count(const float haystack[]; const float needle) 24 | { 25 | int count = 0; 26 | int index = 0; 27 | while (1) 28 | { 29 | index = find(haystack, needle, index + 1); 30 | if (index > -1) 31 | ++count; 32 | else 33 | break; 34 | } 35 | return count; 36 | } 37 | 38 | int 39 | avl_count(const int haystack[]; const int needle) 40 | { 41 | int count = 0; 42 | int index = 0; 43 | while (1) 44 | { 45 | index = find(haystack, needle, index + 1); 46 | if (index > -1) 47 | ++count; 48 | else 49 | break; 50 | } 51 | return count; 52 | } 53 | 54 | int 55 | avl_count(const string haystack[]; const string needle) 56 | { 57 | int count = 0; 58 | int index = 0; 59 | while (1) 60 | { 61 | index = find(haystack, needle, index + 1); 62 | if (index > -1) 63 | ++count; 64 | else 65 | break; 66 | } 67 | return count; 68 | } 69 | 70 | int 71 | avl_count(const vector2 haystack[]; const vector2 needle) 72 | { 73 | int count = 0; 74 | int index = 0; 75 | while (1) 76 | { 77 | index = find(haystack, needle, index + 1); 78 | if (index > -1) 79 | ++count; 80 | else 81 | break; 82 | } 83 | return count; 84 | } 85 | 86 | int 87 | avl_count(const vector haystack[]; const vector needle) 88 | { 89 | int count = 0; 90 | int index = 0; 91 | while (1) 92 | { 93 | index = find(haystack, needle, index + 1); 94 | if (index > -1) 95 | ++count; 96 | else 97 | break; 98 | } 99 | return count; 100 | } 101 | 102 | int 103 | avl_count(const vector4 haystack[]; const vector4 needle) 104 | { 105 | int count = 0; 106 | int index = 0; 107 | while (1) 108 | { 109 | index = find(haystack, needle, index + 1); 110 | if (index > -1) 111 | ++count; 112 | else 113 | break; 114 | } 115 | return count; 116 | } 117 | 118 | int 119 | avl_count(const matrix2 haystack[]; const matrix2 needle) 120 | { 121 | int count = 0; 122 | int index = 0; 123 | while (1) 124 | { 125 | index = find(haystack, needle, index + 1); 126 | if (index > -1) 127 | ++count; 128 | else 129 | break; 130 | } 131 | return count; 132 | } 133 | 134 | int 135 | avl_count(const matrix3 haystack[]; const matrix3 needle) 136 | { 137 | int count = 0; 138 | int index = 0; 139 | while (1) 140 | { 141 | index = find(haystack, needle, index + 1); 142 | if (index > -1) 143 | ++count; 144 | else 145 | break; 146 | } 147 | return count; 148 | } 149 | 150 | int 151 | avl_count(const matrix haystack[]; const matrix needle) 152 | { 153 | int count = 0; 154 | int index = 0; 155 | while (1) 156 | { 157 | index = find(haystack, needle, index + 1); 158 | if (index > -1) 159 | ++count; 160 | else 161 | break; 162 | } 163 | return count; 164 | } 165 | 166 | #endif // _AVL_COUNT_H_ 167 | -------------------------------------------------------------------------------- /vex/include/avl_polyextrude.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_POLYEXTRUDE_H_ 3 | #define _AVL_POLYEXTRUDE_H_ 4 | 5 | #include "avl_copyprimattribs.h" 6 | #include "avl_copyprimgroups.h" 7 | #include "avl_reversevertexorder.h" 8 | 9 | int[] 10 | avl_polyextrude(const int geohandle; 11 | const int primnum; 12 | const float distance; 13 | const float inset; 14 | const int limitInsetting; 15 | const float commonLimit; 16 | const float twist; 17 | const int divisions; 18 | const int outputFront; 19 | const int outputFrontGroup; 20 | const string frontGroupName; 21 | const int outputSide; 22 | const int outputSideGroup; 23 | const string sideGroupName; 24 | const int outputBack; 25 | const int outputBackGroup; 26 | const string backGroupName) 27 | { 28 | int primitives[]; 29 | 30 | if (distance == 0 && inset == 0) 31 | return primitives; 32 | 33 | vector primNormal = normalize(prim_normal(geohandle, primnum, {0.5, 0.5, 0})); 34 | vector primCenter = prim(geohandle, 'P', primnum); 35 | 36 | int points[] = primpoints(geohandle, primnum); 37 | int sourcePointCount = len(points); 38 | resize(points, sourcePointCount * divisions); 39 | 40 | if (!outputBack) 41 | removeprim(geohandle, primnum, 0); 42 | else 43 | { 44 | if (distance >= 0) 45 | avl_reversevertexorder(geohandle, primnum); 46 | if (outputBackGroup) 47 | setprimgroup(geohandle, backGroupName, primnum, 1); 48 | append(primitives, primnum); 49 | } 50 | 51 | vector shifts[]; 52 | resize(shifts, sourcePointCount); 53 | vector sourcePointPosition, insetShift, shift; 54 | float insetLimit; 55 | for (int i = 0; i < sourcePointCount; ++i) 56 | { 57 | sourcePointPosition = point(geohandle, 'P', points[i]); 58 | insetShift = primCenter - sourcePointPosition; 59 | if (limitInsetting) 60 | { 61 | insetLimit = commonLimit == 0 ? length(insetShift) : commonLimit; 62 | shift = primNormal * distance + normalize(insetShift) * min(inset, insetLimit); 63 | } else 64 | shift = primNormal * distance + normalize(insetShift) * inset; 65 | shifts[i] = shift / divisions; 66 | } 67 | 68 | if (outputSide) // Todo (1.0): output front 69 | { 70 | for (int d = 1; d <= divisions; ++d) 71 | { 72 | for (int i = 0; i < sourcePointCount; ++i) 73 | { 74 | int newPoint = addpoint(geohandle, points[i]); 75 | setpointattrib(geohandle, 'P', newPoint, shifts[i] * d, 'add'); 76 | points[sourcePointCount * d + i] = newPoint; 77 | } 78 | for (int v = 0; v < sourcePointCount; ++v) 79 | { 80 | int side = addprim(geohandle, 'poly'); 81 | addvertex(geohandle, side, points[sourcePointCount * (d-1) + v]); 82 | addvertex(geohandle, side, points[sourcePointCount * (d-1) + ((v + 1) % sourcePointCount)]); 83 | addvertex(geohandle, side, points[sourcePointCount * d + ((v + 1) % sourcePointCount)]); 84 | addvertex(geohandle, side, points[sourcePointCount * d + v]); 85 | if (outputSideGroup) 86 | setprimgroup(geohandle, sideGroupName, side, 1); 87 | append(primitives, side); 88 | } 89 | } 90 | } 91 | 92 | if (outputFront) 93 | { 94 | int front = addprim(geohandle, 'poly', points[-sourcePointCount:]); 95 | avl_copyprimattribs(geohandle, geohandle, primnum, front, 'set'); 96 | avl_copyprimgroups(geohandle, geohandle, primnum, front, 'set'); 97 | if (outputFrontGroup) 98 | setprimgroup(geohandle, frontGroupName, front, 1); 99 | append(primitives, front); 100 | } 101 | return primitives; 102 | } 103 | 104 | #endif // _AVL_POLYEXTRUDE_H_ 105 | -------------------------------------------------------------------------------- /vex/include/avl.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_H_ 3 | #define _AVL_H_ 4 | 5 | #include "avl_version.h" 6 | #include "avl_primarea.h" // doc 7 | #include "avl_primperimeter.h" // doc 8 | #include "avl_primvolume.h" // doc 9 | #include "avl_round.h" // doc 10 | #include "avl_swap.h" // doc 11 | #include "avl_angle.h" // doc 12 | #include "avl_unique.h" // doc 13 | #include "avl_median.h" // doc 14 | #include "avl_medianhigh.h" // doc 15 | #include "avl_medianlow.h" // doc 16 | #include "avl_clamp01.h" // doc 17 | #include "avl_clamp11.h" // doc 18 | #include "avl_shift.h" // doc 19 | #include "avl_polyneighbours.h" // doc 20 | #include "avl_pointattribs.h" // doc 21 | #include "avl_vertexattribs.h" // doc 22 | #include "avl_primattribs.h" // doc 23 | #include "avl_detailattribs.h" // doc 24 | #include "avl_pointgroups.h" // doc 25 | #include "avl_vertexgroups.h" // doc 26 | #include "avl_primgroups.h" // doc 27 | #include "avl_edgegroups.h" // doc 28 | #include "avl_padzero.h" // doc 29 | #include "avl_inside.h" // doc 30 | #include "avl_print.h" // doc 31 | #include "avl_triarea.h" // doc 32 | #include "avl_trinormal.h" // doc 33 | #include "avl_insphere.h" // doc 34 | #include "avl_range.h" // Todo: check 35 | #include "avl_hedge_srcpos.h" // doc 36 | #include "avl_hedge_dstpos.h" // doc 37 | #include "avl_hedge_presrcpos.h" // doc 38 | #include "avl_hedge_postdstpos.h" // doc 39 | #include "avl_normalizevalues.h" // doc 40 | #include "avl_count.h" // doc 41 | #include "avl_colors.h" // doc 42 | #include "avl_copypointattrib.h" 43 | #include "avl_copypointattribs.h" 44 | #include "avl_copyprimattrib.h" 45 | #include "avl_copyprimattribs.h" 46 | #include "avl_copyvertexattrib.h" 47 | #include "avl_copyvertexattribs.h" 48 | #include "avl_copydetailattrib.h" 49 | #include "avl_copydetailattribs.h" 50 | #include "avl_tostr.h" 51 | #include "avl_sphericaldistance.h" 52 | #include "avl_copypointgroup.h" 53 | #include "avl_copypointgroups.h" 54 | #include "avl_copyprimgroup.h" 55 | #include "avl_copyprimgroups.h" 56 | #include "avl_copyvertexgroup.h" 57 | #include "avl_copyvertexgroups.h" 58 | #include "avl_copyedgegroup.h" 59 | #include "avl_copyedgegroups.h" 60 | #include "avl_hedge_opposite.h" 61 | #include "avl_pointcurvature.h" 62 | #include "avl_splitext.h" 63 | #include "avl_almostequal.h" 64 | #include "avl_shiftvertexorder.h" 65 | #include "avl_reversevertexorder.h" 66 | #include "avl_getbbox_volume.h" 67 | #include "avl_getpointbbox_volume.h" 68 | #include "avl_getbbox_area.h" 69 | #include "avl_getpointbbox_area.h" 70 | #include "avl_tricentroid.h" 71 | #include "avl_istiny.h" 72 | #include "avl_mode.h" 73 | #include "avl_sample.h" 74 | #include "avl_choice.h" 75 | #include "avl_shuffle.h" 76 | #include "avl_isodd.h" 77 | #include "avl_iseven.h" 78 | #include "avl_inbbox.h" 79 | #include "avl_inpointbbox.h" 80 | #include "avl_inrect.h" 81 | #include "avl_incircle.h" 82 | #include "avl_circlelength.h" 83 | #include "avl_circlearea.h" 84 | #include "avl_spherevolume.h" 85 | #include "avl_spherearea.h" 86 | //#include "avl_isconvex.h" 87 | //#include "avl_isconcave.h" 88 | #include "avl_isflat.h" 89 | //#include "avl_merge.h" // mergevalues? 90 | //#include "avl_polycurvature.h" 91 | #include "avl_triangulate.h" 92 | #include "avl_polyextrude.h" 93 | //#include "avl_convolve1d.h" 94 | //#include "avl_filter.h"s 95 | //#include "avl_gradient.h" 96 | //#include "avl_convolve2d.h" 97 | //#include "avl_convolve3d.h" 98 | //#include "avl_rawgroupisvalid.h" 99 | //#include "avl_rawgrouppack.h" 100 | //#include "avl_rawgroupunpack.h" 101 | //#include "avl_rawgroupcompress.h" 102 | //#include "avl_rawgroupmerge.h" 103 | //#include "avl_rawgroupcontains.h" 104 | //#include "avl_rawgroupbyrange.h" 105 | //#include "avl_selectloop.h" 106 | //#include "avl_selectring.h" 107 | #include "avl_polyarea.h" 108 | #include "avl_polyvolume.h" 109 | #include "avl_polycentroid.h" 110 | #include "avl_primcentroid.h" 111 | #include "avl_polyperimeter.h" 112 | #include "avl_triperimeter.h" 113 | #include "avl_trivolume.h" 114 | //#include "avl_bfind.h" 115 | #include "avl_limits.h" // doc // double ?? 116 | #include "avl_randrange.h" 117 | #include "avl_frompolar.h" 118 | #include "avl_topolar.h" 119 | #include "avl_in.h" 120 | #include "avl_randint.h" 121 | //#include "avl_fromspherical.h" 122 | //#include "avl_tospherical.h" 123 | #include "avl_removeduplicates.h" 124 | #include "avl_removevertex.h" // doc 125 | #include "avl_maxindex.h" // doc 126 | #include "avl_minindex.h" // doc 127 | #include "avl_primtype.h" 128 | #include "avl_primtypename.h" 129 | #include "avl_polysplit.h" 130 | #include "avl_copyprim.h" 131 | #include "avl_copypoint.h" 132 | #include "avl_pointnormal.h" 133 | #include "avl_vertexnormal.h" 134 | #include "avl_primnormal.h" 135 | //#include "avl_divide.h" 136 | #include "avl_isclosed.h" 137 | #include "avl_ispolyline.h" 138 | 139 | #endif // _AVL_H_ 140 | -------------------------------------------------------------------------------- /vex/include/avl_randrange.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_RANDRANGE_H_ 3 | #define _AVL_RANDRANGE_H_ 4 | 5 | float 6 | avl_randrange(const float seed; 7 | const float min; 8 | const float max) 9 | { 10 | return fit01(rand(seed), min, max); 11 | } 12 | 13 | float 14 | avl_randrange(const float seed; 15 | const float seed2; 16 | const float min; 17 | const float max) 18 | { 19 | return fit01(rand(seed, seed2), min, max); 20 | } 21 | 22 | float 23 | avl_randrange(const vector2 seed; 24 | const float min; 25 | const float max) 26 | { 27 | return fit01(rand(seed), min, max); 28 | } 29 | 30 | float 31 | avl_randrange(const vector seed; 32 | const float min; 33 | const float max) 34 | { 35 | return fit01(rand(seed), min, max); 36 | } 37 | 38 | float 39 | avl_randrange(const vector4 seed; 40 | const float min; 41 | const float max) 42 | { 43 | return fit01(rand(seed), min, max); 44 | } 45 | 46 | int 47 | avl_randrange(const float seed; 48 | const int min; 49 | const int max) 50 | { 51 | return (int)fit01(rand(seed), min, max); 52 | } 53 | 54 | int 55 | avl_randrange(const float seed; 56 | const float seed2; 57 | const int min; 58 | const int max) 59 | { 60 | return (int)fit01(rand(seed, seed2), min, max); 61 | } 62 | 63 | int 64 | avl_randrange(const vector2 seed; 65 | const int min; 66 | const int max) 67 | { 68 | return (int)fit01(rand(seed), min, max); 69 | } 70 | 71 | int 72 | avl_randrange(const vector seed; 73 | const int min; 74 | const int max) 75 | { 76 | return (int)fit01(rand(seed), min, max); 77 | } 78 | 79 | int 80 | avl_randrange(const vector4 seed; 81 | const int min; 82 | const int max) 83 | { 84 | return (int)fit01(rand(seed), min, max); 85 | } 86 | 87 | vector2 88 | avl_randrange(const float seed; 89 | const vector2 min; 90 | const vector2 max) 91 | { 92 | return fit01(vector2(rand(seed)), min, max); 93 | } 94 | 95 | vector2 96 | avl_randrange(const float seed; 97 | const float seed2; 98 | const vector2 min; 99 | const vector2 max) 100 | { 101 | return fit01(vector2(rand(seed, seed2)), min, max); 102 | } 103 | 104 | vector2 105 | avl_randrange(const vector2 seed; 106 | const vector2 min; 107 | const vector2 max) 108 | { 109 | return fit01(vector2(rand(seed)), min, max); 110 | } 111 | 112 | vector2 113 | avl_randrange(const vector seed; 114 | const vector2 min; 115 | const vector2 max) 116 | { 117 | return fit01(vector2(rand(seed)), min, max); 118 | } 119 | 120 | vector2 121 | avl_randrange(const vector4 seed; 122 | const vector2 min; 123 | const vector2 max) 124 | { 125 | return fit01(vector2(rand(seed)), min, max); 126 | } 127 | 128 | vector 129 | avl_randrange(const float seed; 130 | const vector min; 131 | const vector max) 132 | { 133 | return fit01(vector(rand(seed)), min, max); 134 | } 135 | 136 | vector 137 | avl_randrange(const float seed; 138 | const float seed2; 139 | const vector min; 140 | const vector max) 141 | { 142 | return fit01(vector(rand(seed)), min, max); 143 | } 144 | 145 | vector 146 | avl_randrange(const vector2 seed; 147 | const vector min; 148 | const vector max) 149 | { 150 | return fit01(vector(rand(seed)), min, max); 151 | } 152 | 153 | vector 154 | avl_randrange(const vector seed; 155 | const vector min; 156 | const vector max) 157 | { 158 | return fit01(vector(rand(seed)), min, max); 159 | } 160 | 161 | vector 162 | avl_randrange(const vector4 seed; 163 | const vector min; 164 | const vector max) 165 | { 166 | return fit01(vector(rand(seed)), min, max); 167 | } 168 | 169 | vector4 170 | avl_randrange(const float seed; 171 | const vector4 min; 172 | const vector4 max) 173 | { 174 | return fit01(vector4(rand(seed)), min, max); 175 | } 176 | 177 | vector4 178 | avl_randrange(const float seed; 179 | const float seed2; 180 | const vector4 min; 181 | const vector4 max) 182 | { 183 | return fit01(vector4(rand(seed, seed2)), min, max); 184 | } 185 | 186 | vector4 187 | avl_randrange(const vector2 seed; 188 | const vector4 min; 189 | const vector4 max) 190 | { 191 | return fit01(vector4(rand(seed)), min, max); 192 | } 193 | 194 | vector4 195 | avl_randrange(const vector seed; 196 | const vector4 min; 197 | const vector4 max) 198 | { 199 | return fit01(vector4(rand(seed)), min, max); 200 | } 201 | 202 | vector4 203 | avl_randrange(const vector4 seed; 204 | const vector4 min; 205 | const vector4 max) 206 | { 207 | return fit01(vector4(rand(seed)), min, max); 208 | } 209 | 210 | #endif // _AVL_RANDRANGE_H_ 211 | -------------------------------------------------------------------------------- /vex/include/avl_copydetailattrib.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_COPYDETAILATTRIB_H_ 3 | #define _AVL_COPYDETAILATTRIB_H_ 4 | 5 | int 6 | avl_copydetailattrib(const int geometry; 7 | const int geohandle; 8 | const string attribName) 9 | { 10 | int success = -1; 11 | int attribType = detailattribtype(geometry, attribName); 12 | if (attribType == 1) // Float-based attributes 13 | { 14 | int attribSize = detailattribsize(geometry, attribName); 15 | if (attribSize == 1) // Float 16 | { 17 | float value = detail(geometry, attribName); 18 | success = setdetailattrib(geohandle, attribName, value); 19 | } else if (attribSize == 3) // Vector 20 | { 21 | vector value = detail(geometry, attribName); 22 | success = setdetailattrib(geohandle, attribName, value); 23 | } else if (attribSize == 4) // Vector4 or Matrix2 24 | { 25 | vector4 value = detail(geometry, attribName); 26 | success = setdetailattrib(geohandle, attribName, value); 27 | } else if (attribSize == 9) // Matrtix3 28 | { 29 | matrix3 value = detail(geometry, attribName); 30 | success = setdetailattrib(geohandle, attribName, value); 31 | } else if (attribSize == 16) // Matrix 32 | { 33 | matrix value = detail(geometry, attribName); 34 | success = setdetailattrib(geohandle, attribName, value); 35 | } else if (attribSize == 2) // Vector2 36 | { 37 | vector2 value = detail(geometry, attribName); 38 | success = setdetailattrib(geohandle, attribName, value); 39 | } else 40 | { 41 | error('Copy Attribute AVL: Unsupported size'); 42 | return success; 43 | } 44 | } else if (attribType == 0) // Integer 45 | { 46 | int value = detail(geometry, attribName); 47 | success = setdetailattrib(geohandle, attribName, value); 48 | } else if (attribType == 2) // String 49 | { 50 | string value = detail(geometry, attribName); 51 | success = setdetailattrib(geohandle, attribName, value); 52 | } else if (attribType == 4) // Float-based Array 53 | { 54 | int attribSize = detailattribsize(geometry, attribName); 55 | if (attribSize == 1) // Float 56 | { 57 | float value[] = detail(geometry, attribName); 58 | success = setdetailattrib(geohandle, attribName, value); 59 | } else if (attribSize == 3) // Vector 60 | { 61 | vector value[] = detail(geometry, attribName); 62 | success = setdetailattrib(geohandle, attribName, value); 63 | } else if (attribSize == 4) // Vector4 or Matrix2 64 | { 65 | vector4 value[] = detail(geometry, attribName); 66 | success = setdetailattrib(geohandle, attribName, value); 67 | } else if (attribSize == 9) // Matrtix3 68 | { 69 | matrix3 value[] = detail(geometry, attribName); 70 | success = setdetailattrib(geohandle, attribName, value); 71 | } else if (attribSize == 16) // Matrix 72 | { 73 | matrix value[] = detail(geometry, attribName); 74 | success = setdetailattrib(geohandle, attribName, value); 75 | } else if (attribSize == 2) // Vector2 76 | { 77 | vector2 value[] = detail(geometry, attribName); 78 | success = setdetailattrib(geohandle, attribName, value); 79 | } else 80 | { 81 | error('Copy Attribute AVL: Unsupported size'); 82 | return success; 83 | } 84 | } else if (attribType == 3) // Array of Integers 85 | { 86 | int value[] = detail(geometry, attribName); 87 | success = setdetailattrib(geohandle, attribName, value); 88 | } else if (attribType == 5) // Array of Strings 89 | { 90 | string value[] = detail(geometry, attribName); 91 | success = setdetailattrib(geohandle, attribName, value); 92 | } else 93 | { 94 | error('Copy Attribute AVL: Unsupported type'); 95 | return success; 96 | } 97 | string attribTypeInfo = detailattribtypeinfo(geometry, attribName); 98 | setattribtypeinfo(geohandle, 'detail', attribName, attribTypeInfo); 99 | return success; 100 | } 101 | 102 | int 103 | avl_copydetailattrib(const int geometry; 104 | const int geohandle; 105 | const string attribName; 106 | const string mode) 107 | { 108 | int success = -1; 109 | int attribType = detailattribtype(geometry, attribName); 110 | if (attribType == 1) // Float-based attributes 111 | { 112 | int attribSize = detailattribsize(geometry, attribName); 113 | if (attribSize == 1) // Float 114 | { 115 | float value = detail(geometry, attribName); 116 | success = setdetailattrib(geohandle, attribName, value, mode); 117 | } else if (attribSize == 3) // Vector 118 | { 119 | vector value = detail(geometry, attribName); 120 | success = setdetailattrib(geohandle, attribName, value, mode); 121 | } else if (attribSize == 4) // Vector4 or Matrix2 122 | { 123 | vector4 value = detail(geometry, attribName); 124 | success = setdetailattrib(geohandle, attribName, value, mode); 125 | } else if (attribSize == 9) // Matrtix3 126 | { 127 | matrix3 value = detail(geometry, attribName); 128 | success = setdetailattrib(geohandle, attribName, value, mode); 129 | } else if (attribSize == 16) // Matrix 130 | { 131 | matrix value = detail(geometry, attribName); 132 | success = setdetailattrib(geohandle, attribName, value, mode); 133 | } else if (attribSize == 2) // Vector2 134 | { 135 | vector2 value = detail(geometry, attribName); 136 | success = setdetailattrib(geohandle, attribName, value, mode); 137 | } else 138 | { 139 | error('Copy Attribute AVL: Unsupported size'); 140 | return success; 141 | } 142 | } else if (attribType == 0) // Integer 143 | { 144 | int value = detail(geometry, attribName); 145 | success = setdetailattrib(geohandle, attribName, value, mode); 146 | } else if (attribType == 2) // String 147 | { 148 | string value = detail(geometry, attribName); 149 | success = setdetailattrib(geohandle, attribName, value, mode); 150 | } else if (attribType == 4) // Float-based Array 151 | { 152 | int attribSize = detailattribsize(geometry, attribName); 153 | if (attribSize == 1) // Float 154 | { 155 | float value[] = detail(geometry, attribName); 156 | success = setdetailattrib(geohandle, attribName, value, mode); 157 | } else if (attribSize == 3) // Vector 158 | { 159 | vector value[] = detail(geometry, attribName); 160 | success = setdetailattrib(geohandle, attribName, value, mode); 161 | } else if (attribSize == 4) // Vector4 or Matrix2 162 | { 163 | vector4 value[] = detail(geometry, attribName); 164 | success = setdetailattrib(geohandle, attribName, value, mode); 165 | } else if (attribSize == 9) // Matrtix3 166 | { 167 | matrix3 value[] = detail(geometry, attribName); 168 | success = setdetailattrib(geohandle, attribName, value, mode); 169 | } else if (attribSize == 16) // Matrix 170 | { 171 | matrix value[] = detail(geometry, attribName); 172 | success = setdetailattrib(geohandle, attribName, value, mode); 173 | } else if (attribSize == 2) // Vector2 174 | { 175 | vector2 value[] = detail(geometry, attribName); 176 | success = setdetailattrib(geohandle, attribName, value, mode); 177 | } else 178 | { 179 | error('Copy Attribute AVL: Unsupported size'); 180 | return success; 181 | } 182 | } else if (attribType == 3) // Array of Integers 183 | { 184 | int value[] = detail(geometry, attribName); 185 | success = setdetailattrib(geohandle, attribName, value, mode); 186 | } else if (attribType == 5) // Array of Strings 187 | { 188 | string value[] = detail(geometry, attribName); 189 | success = setdetailattrib(geohandle, attribName, value, mode); 190 | } else 191 | { 192 | error('Copy Attribute AVL: Unsupported type'); 193 | return success; 194 | } 195 | string attribTypeInfo = detailattribtypeinfo(geometry, attribName); 196 | setattribtypeinfo(geohandle, 'detail', attribName, attribTypeInfo); 197 | return success; 198 | } 199 | 200 | #endif // _AVL_COPYDETAILATTRIB_H_ 201 | -------------------------------------------------------------------------------- /vex/include/avl_copypointattrib.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _AVL_COPYPOINTATTRIB_H_ 3 | #define _AVL_COPYPOINTATTRIB_H_ 4 | 5 | int 6 | avl_copypointattrib(const int geometry; 7 | const int geohandle; 8 | const int srcPtnum; 9 | const int dstPtnum; 10 | const string attribName) 11 | { 12 | int success = -1; 13 | int attribType = pointattribtype(geometry, attribName); 14 | if (attribType == 1) // Float-based attributes 15 | { 16 | int attribSize = pointattribsize(geometry, attribName); 17 | if (attribSize == 1) // Float 18 | { 19 | float value = point(geometry, attribName, srcPtnum); 20 | success = setpointattrib(geohandle, attribName, dstPtnum, value); 21 | } else if (attribSize == 3) // Vector 22 | { 23 | vector value = point(geometry, attribName, srcPtnum); 24 | success = setpointattrib(geohandle, attribName, dstPtnum, value); 25 | } else if (attribSize == 4) // Vector4 or Matrix2 26 | { 27 | vector4 value = point(geometry, attribName, srcPtnum); 28 | success = setpointattrib(geohandle, attribName, dstPtnum, value); 29 | } else if (attribSize == 9) // Matrtix3 30 | { 31 | matrix3 value = point(geometry, attribName, srcPtnum); 32 | success = setpointattrib(geohandle, attribName, dstPtnum, value); 33 | } else if (attribSize == 16) // Matrix 34 | { 35 | matrix value = point(geometry, attribName, srcPtnum); 36 | success = setpointattrib(geohandle, attribName, dstPtnum, value); 37 | } else if (attribSize == 2) // Vector2 38 | { 39 | vector2 value = point(geometry, attribName, srcPtnum); 40 | success = setpointattrib(geohandle, attribName, dstPtnum, value); 41 | } else 42 | { 43 | error('Copy Attribute AVL: Unsupported size'); 44 | return success; 45 | } 46 | } else if (attribType == 0) // Integer 47 | { 48 | int value = point(geometry, attribName, srcPtnum); 49 | success = setpointattrib(geohandle, attribName, dstPtnum, value); 50 | } else if (attribType == 2) // String 51 | { 52 | string value = point(geometry, attribName, srcPtnum); 53 | success = setpointattrib(geohandle, attribName, dstPtnum, value); 54 | } else if (attribType == 4) // Float-based Array 55 | { 56 | int attribSize = pointattribsize(geometry, attribName); 57 | if (attribSize == 1) // Float 58 | { 59 | float value[] = point(geometry, attribName, srcPtnum); 60 | success = setpointattrib(geohandle, attribName, dstPtnum, value); 61 | } else if (attribSize == 3) // Vector 62 | { 63 | vector value[] = point(geometry, attribName, srcPtnum); 64 | success = setpointattrib(geohandle, attribName, dstPtnum, value); 65 | } else if (attribSize == 4) // Vector4 or Matrix2 66 | { 67 | vector4 value[] = point(geometry, attribName, srcPtnum); 68 | success = setpointattrib(geohandle, attribName, dstPtnum, value); 69 | } else if (attribSize == 9) // Matrtix3 70 | { 71 | matrix3 value[] = point(geometry, attribName, srcPtnum); 72 | success = setpointattrib(geohandle, attribName, dstPtnum, value); 73 | } else if (attribSize == 16) // Matrix 74 | { 75 | matrix value[] = point(geometry, attribName, srcPtnum); 76 | success = setpointattrib(geohandle, attribName, dstPtnum, value); 77 | } else if (attribSize == 2) // Vector2 78 | { 79 | vector2 value[] = point(geometry, attribName, srcPtnum); 80 | success = setpointattrib(geohandle, attribName, dstPtnum, value); 81 | } else 82 | { 83 | error('Copy Attribute AVL: Unsupported size'); 84 | return success; 85 | } 86 | } else if (attribType == 3) // Array of Integers 87 | { 88 | int value[] = point(geometry, attribName, srcPtnum); 89 | success = setpointattrib(geohandle, attribName, dstPtnum, value); 90 | } else if (attribType == 5) // Array of Strings 91 | { 92 | string value[] = point(geometry, attribName, srcPtnum); 93 | success = setpointattrib(geohandle, attribName, dstPtnum, value); 94 | } else 95 | { 96 | error('Copy Attribute AVL: Unsupported type'); 97 | return success; 98 | } 99 | string attribTypeInfo = pointattribtypeinfo(geometry, attribName); 100 | setattribtypeinfo(geohandle, 'point', attribName, attribTypeInfo); 101 | return success; 102 | } 103 | 104 | int 105 | avl_copypointattrib(const int geometry; 106 | const int geohandle; 107 | const int srcPtnum; 108 | const int dstPtnum; 109 | const string attribName; 110 | const string mode) 111 | { 112 | int success = -1; 113 | int attribType = pointattribtype(geometry, attribName); 114 | if (attribType == 1) // Float-based attributes 115 | { 116 | int attribSize = pointattribsize(geometry, attribName); 117 | if (attribSize == 1) // Float 118 | { 119 | float value = point(geometry, attribName, srcPtnum); 120 | success = setpointattrib(geohandle, attribName, dstPtnum, value, mode); 121 | } else if (attribSize == 3) // Vector 122 | { 123 | vector value = point(geometry, attribName, srcPtnum); 124 | success = setpointattrib(geohandle, attribName, dstPtnum, value, mode); 125 | } else if (attribSize == 4) // Vector4 or Matrix2 126 | { 127 | vector4 value = point(geometry, attribName, srcPtnum); 128 | success = setpointattrib(geohandle, attribName, dstPtnum, value, mode); 129 | } else if (attribSize == 9) // Matrtix3 130 | { 131 | matrix3 value = point(geometry, attribName, srcPtnum); 132 | success = setpointattrib(geohandle, attribName, dstPtnum, value, mode); 133 | } else if (attribSize == 16) // Matrix 134 | { 135 | matrix value = point(geometry, attribName, srcPtnum); 136 | success = setpointattrib(geohandle, attribName, dstPtnum, value, mode); 137 | } else if (attribSize == 2) // Vector2 138 | { 139 | vector2 value = point(geometry, attribName, srcPtnum); 140 | success = setpointattrib(geohandle, attribName, dstPtnum, value, mode); 141 | } else 142 | { 143 | error('Copy Attribute AVL: Unsupported size'); 144 | return success; 145 | } 146 | } else if (attribType == 0) // Integer 147 | { 148 | int value = point(geometry, attribName, srcPtnum); 149 | success = setpointattrib(geohandle, attribName, dstPtnum, value, mode); 150 | } else if (attribType == 2) // String 151 | { 152 | string value = point(geometry, attribName, srcPtnum); 153 | success = setpointattrib(geohandle, attribName, dstPtnum, value, mode); 154 | } else if (attribType == 4) // Float-based Array 155 | { 156 | int attribSize = pointattribsize(geometry, attribName); 157 | if (attribSize == 1) // Float 158 | { 159 | float value[] = point(geometry, attribName, srcPtnum); 160 | success = setpointattrib(geohandle, attribName, dstPtnum, value, mode); 161 | } else if (attribSize == 3) // Vector 162 | { 163 | vector value[] = point(geometry, attribName, srcPtnum); 164 | success = setpointattrib(geohandle, attribName, dstPtnum, value, mode); 165 | } else if (attribSize == 4) // Vector4 or Matrix2 166 | { 167 | vector4 value[] = point(geometry, attribName, srcPtnum); 168 | success = setpointattrib(geohandle, attribName, dstPtnum, value, mode); 169 | } else if (attribSize == 9) // Matrtix3 170 | { 171 | matrix3 value[] = point(geometry, attribName, srcPtnum); 172 | success = setpointattrib(geohandle, attribName, dstPtnum, value, mode); 173 | } else if (attribSize == 16) // Matrix 174 | { 175 | matrix value[] = point(geometry, attribName, srcPtnum); 176 | success = setpointattrib(geohandle, attribName, dstPtnum, value, mode); 177 | } else if (attribSize == 2) // Vector2 178 | { 179 | vector2 value[] = point(geometry, attribName, srcPtnum); 180 | success = setpointattrib(geohandle, attribName, dstPtnum, value, mode); 181 | } else 182 | { 183 | error('Copy Attribute AVL: Unsupported size'); 184 | return success; 185 | } 186 | } else if (attribType == 3) // Array of Integers 187 | { 188 | int value[] = point(geometry, attribName, srcPtnum); 189 | success = setpointattrib(geohandle, attribName, dstPtnum, value, mode); 190 | } else if (attribType == 5) // Array of Strings 191 | { 192 | string value[] = point(geometry, attribName, srcPtnum); 193 | success = setpointattrib(geohandle, attribName, dstPtnum, value, mode); 194 | } else 195 | { 196 | error('Copy Attribute AVL: Unsupported type'); 197 | return success; 198 | } 199 | string attribTypeInfo = pointattribtypeinfo(geometry, attribName); 200 | setattribtypeinfo(geohandle, 'point', attribName, attribTypeInfo); 201 | return success; 202 | } 203 | 204 | #endif // _AVL_COPYPOINTATTRIB_H_ 205 | --------------------------------------------------------------------------------