Menu Home

Taper

osbo.com | Flash | AS3Dmod | Taper

Taper is a modifier that displaces object vertices on two axes in proportion to their position on the third axis.

Example

Taper

Instructions

  1. Import stack, modifier, 3D engine library
    import com.as3dmod.ModifierStack;
    import com.as3dmod.modifiers.Taper;
    import com.as3dmod.plugins.pv3d.LibraryPv3d;
  2. Declare
    private var stack :ModifierStack;
  3. Initialize
    stack = new ModifierStack(lib3d, mesh);
    Parameter Default Description
    lib3d NONE 3D engine library
    mesh NONE 3D object
  4. Add
    stack.addModifier(new Taper(f));
    Parameter Default Description
    f 0 force taper
  5. Apply
    stack.apply();

Code

package
{
    import com.as3dmod.ModifierStack;
    import com.as3dmod.modifiers.Taper;
    import com.as3dmod.plugins.pv3d.LibraryPv3d;

    import flash.events.Event;

    import org.papervision3d.materials.WireframeMaterial;
    import org.papervision3d.objects.primitives.Sphere;
    import org.papervision3d.view.BasicView;

    public class AS3DmodTaper extends BasicView
    {
        private var object :Sphere;
        private var stack  :ModifierStack;

        public function AS3DmodTaper()
        {
            super();

            var material :WireframeMaterial = new WireframeMaterial(0x000000);
            material.doubleSided = true;

            object = new Sphere(material, 200, 10, 10);
            scene.addChild(object);

            stack = new ModifierStack(new LibraryPv3d(), object);
            stack.addModifier(new Taper(2));
            stack.apply();

            startRendering();
        }

        protected override function onRenderTick(e:Event=null):void
        {
            object.yaw(1);

            super.onRenderTick(e);
        }
    }
}

Download