Class QuadSurface

    • Method Detail

      • CCW

        public static float CCW​(Point3D p1,
                                Point3D p2,
                                Point3D p3)
        Three points are a counter-clockwise turn if ccw > 0, clockwise if ccw < 0, and collinear if ccw = 0 because ccw is a determinant that gives the signed area of the triangle formed by p1, p2 and p3.
      • decreaseHorizontalForce

        public void decreaseHorizontalForce()
        Description copied from interface: SuperSurface
        Decrease the amount of horizontal displacement force used for spherical mapping for bezier surfaces. (using orthographic projection)
        Specified by:
        decreaseHorizontalForce in interface SuperSurface
      • decreaseVerticalForce

        public void decreaseVerticalForce()
        Description copied from interface: SuperSurface
        Decrease the amount of horizontal displacement force used for spherical mapping for bezier surfaces. (using orthographic projection)
        Specified by:
        decreaseVerticalForce in interface SuperSurface
      • getActiveBezierPointIndex

        public int getActiveBezierPointIndex​(int mX,
                                             int mY)
        Description copied from interface: SuperSurface
        Returns index 0-7 if coordinates are on a bezier control
        Specified by:
        getActiveBezierPointIndex in interface SuperSurface
        Returns:
      • getActiveCornerPointIndex

        public int getActiveCornerPointIndex​(int mX,
                                             int mY)
        Checks if the coordinates is close to any of the corners, and if not, checks if the coordinates are inside the surface. Returns the index of the corner (0,1,2,3) or (4) if coordinates was inside the surface
        Specified by:
        getActiveCornerPointIndex in interface SuperSurface
        Parameters:
        mX -
        mY -
        Returns:
      • getActivePoint

        public int getActivePoint()
        Get the index of the active corner
        Specified by:
        getActivePoint in interface SuperSurface
        Returns:
      • getArea

        public double getArea()
        Calculate the area in squarepixels
        Specified by:
        getArea in interface SuperSurface
        Returns:
        returns the area as N squarepixels
      • getBlendLeftSize

        public float getBlendLeftSize()
        Description copied from interface: SuperSurface
        Get the width of the left edge blend
        Specified by:
        getBlendLeftSize in interface SuperSurface
        Returns:
      • getBlendRightSize

        public float getBlendRightSize()
        Description copied from interface: SuperSurface
        Get the width of the right edge blend
        Specified by:
        getBlendRightSize in interface SuperSurface
        Returns:
      • getBufferScreenWidth

        public int getBufferScreenWidth()
      • getCenter

        public Point3D getCenter()
        Find the average position of all the control points, use that as the center point.
        Specified by:
        getCenter in interface SuperSurface
        Returns:
      • getColor

        public int getColor()
        Get the fill color of the surface in calibration mode
        Specified by:
        getColor in interface SuperSurface
        Returns:
      • getCornerPoint

        public Point3D getCornerPoint​(int index)
        Get a specific corner
        Specified by:
        getCornerPoint in interface SuperSurface
        Parameters:
        index -
        Returns:
      • getHorizontalForce

        public int getHorizontalForce()
        Description copied from interface: SuperSurface
        Get the amount of horizontal displacement force used for spherical mapping for bezier surfaces.
        Specified by:
        getHorizontalForce in interface SuperSurface
      • getId

        public int getId()
        Get the surfaces ID
        Specified by:
        getId in interface SuperSurface
        Returns:
      • getLocked

        public boolean getLocked()
        See if the surface is locked
        Returns:
      • getLongestSide

        public double getLongestSide()
        Get the longest side as double
        Specified by:
        getLongestSide in interface SuperSurface
        Returns:
      • getRes

        public int getRes()
        Get the amount of subdivision used in the surface
        Specified by:
        getRes in interface SuperSurface
        Returns:
      • getSelectedBezierControl

        public int getSelectedBezierControl()
        Get the currently selected bezier control
        Specified by:
        getSelectedBezierControl in interface SuperSurface
        Returns:
      • getSelectedCorner

        public int getSelectedCorner()
        Get the currently selected corner
        Specified by:
        getSelectedCorner in interface SuperSurface
        Returns:
      • getSurfaceType

        public int getSurfaceType()
        Description copied from interface: SuperSurface
        See which type this surface is
        Specified by:
        getSurfaceType in interface SuperSurface
        Returns:
      • getVerticalForce

        public int getVerticalForce()
        Description copied from interface: SuperSurface
        Get the amount of vertical displacement force used for spherical mapping for bezier surfaces.
        Specified by:
        getVerticalForce in interface SuperSurface
      • increaseHorizontalForce

        public void increaseHorizontalForce()
        Description copied from interface: SuperSurface
        Increase the amount of horizontal displacement force used for spherical mapping for bezier surfaces. (using orthographic projection)
        Specified by:
        increaseHorizontalForce in interface SuperSurface
      • increaseVerticalForce

        public void increaseVerticalForce()
        Description copied from interface: SuperSurface
        Increase the amount of vertical displacement force used for spherical mapping for bezier surfaces. (using orthographic projection)
        Specified by:
        increaseVerticalForce in interface SuperSurface
      • isBlendLeft

        public boolean isBlendLeft()
        Description copied from interface: SuperSurface
        See if the surface has been set to blend on the left
        Specified by:
        isBlendLeft in interface SuperSurface
        Returns:
      • isBlendRight

        public boolean isBlendRight()
        Description copied from interface: SuperSurface
        See if the surface has been set to blend on the right
        Specified by:
        isBlendRight in interface SuperSurface
        Returns:
      • isCornerMovementAllowed

        public boolean isCornerMovementAllowed()
        Description copied from interface: SuperSurface
        See if we can move the cornerpoint of the surface
        Specified by:
        isCornerMovementAllowed in interface SuperSurface
        Returns:
      • isHidden

        public boolean isHidden()
        See if the surface is hidden
        Specified by:
        isHidden in interface SuperSurface
        Returns:
      • isInside

        public boolean isInside​(float mX,
                                float mY)
        Check if coordinates are inside the surface
        Specified by:
        isInside in interface SuperSurface
        Parameters:
        mX -
        mY -
        Returns:
      • isLocked

        public boolean isLocked()
        Description copied from interface: SuperSurface
        See if the surface is locked
        Specified by:
        isLocked in interface SuperSurface
        Returns:
      • isSelected

        public boolean isSelected()
        See if the surface is selected
        Specified by:
        isSelected in interface SuperSurface
        Returns:
      • isUsingEdgeBlend

        public boolean isUsingEdgeBlend()
        Description copied from interface: SuperSurface
        See if the surface is using edge blend
        Specified by:
        isUsingEdgeBlend in interface SuperSurface
        Returns:
      • render

        public void render​(processing.core.PGraphics g)
        Render method for rendering while in calibration mode
        Specified by:
        render in interface SuperSurface
        Parameters:
        g -
      • render

        public void render​(processing.core.PGraphics g,
                           processing.core.PImage tex)
        Render method for rendering in RENDER mode. Takes one GLGraphicsOffScreen and one GLTexture. The GLTexture is the texture used for the surface, and is drawn to the offscreen buffer.
        Specified by:
        render in interface SuperSurface
        Parameters:
        g -
        tex -
      • rotateCornerPoints

        public void rotateCornerPoints​(int direction)
        Rotate the cornerpoints in direction (0=ClockWise 1=CounterClockWise)
        Specified by:
        rotateCornerPoints in interface SuperSurface
        Parameters:
        direction -
      • screenCoordinatesToQuad

        public Point3D screenCoordinatesToQuad​(float x,
                                               float y)
        Translate a point on the screen into a point in the surface.
        Specified by:
        screenCoordinatesToQuad in interface SuperSurface
        Parameters:
        x -
        y -
        Returns:
      • setActivePoint

        public void setActivePoint​(int activePoint)
        Set index of which corner is active
        Specified by:
        setActivePoint in interface SuperSurface
        Parameters:
        activePoint -
      • setBezierPoint

        public void setBezierPoint​(int pointIndex,
                                   float x,
                                   float y)
        Description copied from interface: SuperSurface
        Set target bezier control point to coordinates
        Specified by:
        setBezierPoint in interface SuperSurface
      • setBlendLeft

        public void setBlendLeft​(boolean blendLeft)
        Description copied from interface: SuperSurface
        Set if the left side should be blended
        Specified by:
        setBlendLeft in interface SuperSurface
      • setBlendLeftSize

        public void setBlendLeftSize​(float blendLeftSize)
        Description copied from interface: SuperSurface
        Set the width of the left edge blend
        Specified by:
        setBlendLeftSize in interface SuperSurface
      • setBlendRight

        public void setBlendRight​(boolean blendRight)
        Description copied from interface: SuperSurface
        Set if the right side should be blended
        Specified by:
        setBlendRight in interface SuperSurface
      • setBlendRightSize

        public void setBlendRightSize​(float blendRightSize)
        Description copied from interface: SuperSurface
        Set the width of the right edge blend
        Specified by:
        setBlendRightSize in interface SuperSurface
      • setBufferScreenWidth

        public void setBufferScreenWidth​(int bufferScreenWidth)
        Description copied from interface: SuperSurface
        Set the width of the buffer offscreen
        Specified by:
        setBufferScreenWidth in interface SuperSurface
      • setColor

        public void setColor​(int ccolor)
        Sets the fill color of the surface in calibration mode
        Specified by:
        setColor in interface SuperSurface
        Parameters:
        ccolor -
      • setCornerPoint

        public void setCornerPoint​(int pointIndex,
                                   float inX,
                                   float inY)
        Set the coordinates of one of the target corner points. But first check that all angles are clockwise, to avoid concave shapes (collinearity is not allowed either as it freaks out the matrix calculation)
        Specified by:
        setCornerPoint in interface SuperSurface
        Parameters:
        pointIndex -
      • setCornerPoints

        public void setCornerPoints​(float x0,
                                    float y0,
                                    float x1,
                                    float y1,
                                    float x2,
                                    float y2,
                                    float x3,
                                    float y3)
        Set all four corners of the surface
        Specified by:
        setCornerPoints in interface SuperSurface
        Parameters:
        x0 -
        y0 -
        x1 -
        y1 -
        x2 -
        y2 -
        x3 -
        y3 -
      • setHide

        public void setHide​(boolean hidden)
        Set if the surface should be hidden
        Specified by:
        setHide in interface SuperSurface
        Parameters:
        hidden -
      • setId

        public void setId​(int id)
        Set the surfaces ID
        Specified by:
        setId in interface SuperSurface
        Parameters:
        id -
      • setLocked

        public void setLocked​(boolean isLocked)
        Set if the surface is locked
        Specified by:
        setLocked in interface SuperSurface
        Parameters:
        isLocked -
      • setSelected

        public void setSelected​(boolean selected)
        Set if the surface is selected
        Specified by:
        setSelected in interface SuperSurface
        Parameters:
        selected -
      • setSelectedBezierControl

        public void setSelectedBezierControl​(int selectedBezierControl)
        Description copied from interface: SuperSurface
        Set target bezier control to selected
        Specified by:
        setSelectedBezierControl in interface SuperSurface
      • setSelectedCorner

        public void setSelectedCorner​(int selectedCorner)
        Set the currently selected corner
        Specified by:
        setSelectedCorner in interface SuperSurface
        Parameters:
        selectedCorner -
      • setShake

        public void setShake​(int strength,
                             int speed,
                             int fallOfSpeed)
        Set parameters for shaking the surface. Strength == max Z-displacement, Speed == vibration speed, FallOfSpeed 1-1000 == how fast strength is diminished
        Specified by:
        setShake in interface SuperSurface
        Parameters:
        strength -
        speed -
        fallOfSpeed -
      • setSurfaceMask

        public void setSurfaceMask​(processing.core.PImage mask)
        Specified by:
        setSurfaceMask in interface SuperSurface
      • setTextureWindow

        public void setTextureWindow​(float x,
                                     float y,
                                     float width,
                                     float height)
        Manually set coordinates for mapping the texture. This allows for easy cropping and enables a single texture to span more than one surface. Use normalized values for the values! (i.e 0-1)
        Specified by:
        setTextureWindow in interface SuperSurface
      • setZ

        public void setZ​(float currentZ)
        Set Z-displacement for all coordinates of surface
        Specified by:
        setZ in interface SuperSurface
        Parameters:
        currentZ -
      • setSketchIndex

        public void setSketchIndex​(int sketchIndex)
        Description copied from interface: SuperSurface
        Set the actual sketch index.
        Specified by:
        setSketchIndex in interface SuperSurface
      • shake

        public void shake()
        Tells surface to shake (will only do something if setShake has been called quite recently)
        Specified by:
        shake in interface SuperSurface
      • toggleLocked

        public void toggleLocked()
        Toggle if surface is locked (a locked surface cannot be moved or manipulated in calibration mode, but other surfaces still snap to it)
        Specified by:
        toggleLocked in interface SuperSurface