ixagon.surface.mapper
Class QuadSurface

java.lang.Object
  extended by ixagon.surface.mapper.QuadSurface
All Implemented Interfaces:
SuperSurface

public class QuadSurface
extends Object
implements SuperSurface


Field Summary
 
Fields inherited from interface ixagon.surface.mapper.SuperSurface
BEZIER, DEFAULT_SIZE, QUAD
 
Method Summary
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.
 void clearSurfaceMask()
           
 void decreaseHorizontalForce()
          Decrease the amount of horizontal displacement force used for spherical mapping for bezier surfaces.
 void decreaseResolution()
          Decrease the subdivision
 void decreaseVerticalForce()
          Decrease the amount of horizontal displacement force used for spherical mapping for bezier surfaces.
 int getActiveBezierPointIndex(int mX, int mY)
          Returns index 0-7 if coordinates are on a bezier control
 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.
 int getActivePoint()
          Get the index of the active corner
 double getArea()
          Calculate the area in squarepixels
 Point3D getBezierPoint(int index)
          Get target Bezier control point
 float getBlendLeftSize()
          Get the width of the left edge blend
 float getBlendRightSize()
          Get the width of the right edge blend
 int getBufferScreenWidth()
           
 Point3D getCenter()
          Find the average position of all the control points, use that as the center point.
 int getColor()
          Get the fill color of the surface in calibration mode
 Point3D getCornerPoint(int index)
          Get a specific corner
 Point3D[] getCornerPoints()
          Get all corners
 int getHorizontalForce()
          Get the amount of horizontal displacement force used for spherical mapping for bezier surfaces.
 int getId()
          Get the surfaces ID
 boolean getLocked()
          See if the surface is locked
 double getLongestSide()
          Get the longest side as double
 File getMaskFile()
           
 Polygon getPolygon()
          Get the surface as a polygon
 int getRes()
          Get the amount of subdivision used in the surface
 int getSelectedBezierControl()
          Get the currently selected bezier control
 int getSelectedCorner()
          Get the currently selected corner
 Sketch getSketch()
           
 processing.core.PImage getSurfaceMask()
           
 String getSurfaceName()
           
 int getSurfaceType()
          See which type this surface is
 processing.core.PVector[] getTextureWindow()
           
 int getVerticalForce()
          Get the amount of vertical displacement force used for spherical mapping for bezier surfaces.
 void increaseHorizontalForce()
          Increase the amount of horizontal displacement force used for spherical mapping for bezier surfaces.
 void increaseResolution()
          Increase the subdivision
 void increaseVerticalForce()
          Increase the amount of vertical displacement force used for spherical mapping for bezier surfaces.
 boolean isBlendLeft()
          See if the surface has been set to blend on the left
 boolean isBlendRight()
          See if the surface has been set to blend on the right
 boolean isCornerMovementAllowed()
          See if we can move the cornerpoint of the surface
 boolean isHidden()
          See if the surface is hidden
 boolean isInside(float mX, float mY)
          Check if coordinates are inside the surface
 boolean isLocked()
          See if the surface is locked
 boolean isSelected()
          See if the surface is selected
 boolean isUsingEdgeBlend()
          See if the surface is using edge blend
 boolean isUsingSurfaceMask()
           
 void render(processing.core.PGraphics g)
          Render method for rendering while in calibration mode
 void render(processing.core.PGraphics g, processing.core.PImage tex)
          Render method for rendering in RENDER mode.
 void rotateCornerPoints(int direction)
          Rotate the cornerpoints in direction (0=ClockWise 1=CounterClockWise)
 Point3D screenCoordinatesToQuad(float x, float y)
          Translate a point on the screen into a point in the surface.
 void setActivePoint(int activePoint)
          Set index of which corner is active
 void setBezierPoint(int pointIndex, float x, float y)
          Set target bezier control point to coordinates
 void setBlendLeft(boolean blendLeft)
          Set if the left side should be blended
 void setBlendLeftSize(float blendLeftSize)
          Set the width of the left edge blend
 void setBlendRight(boolean blendRight)
          Set if the right side should be blended
 void setBlendRightSize(float blendRightSize)
          Set the width of the right edge blend
 void setBufferScreenWidth(int bufferScreenWidth)
          Set the width of the buffer offscreen
 void setColor(int ccolor)
          Sets the fill color of the surface in calibration mode
 void setCornerPoint(int pointIndex, float inX, float inY)
          Set the coordinates of one of the target corner points.
 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
 void setHide(boolean hidden)
          Set if the surface should be hidden
 void setId(int id)
          Set the surfaces ID
 void setLocked(boolean isLocked)
          Set if the surface is locked
 void setMaskFile(File maskFile)
           
 void setModeCalibrate()
          Set surface to calibration mode
 void setModeRender()
          Set surface to render mode
 void setSelected(boolean selected)
          Set if the surface is selected
 void setSelectedBezierControl(int selectedBezierControl)
          Set target bezier control to selected
 void setSelectedCorner(int selectedCorner)
          Set the currently selected corner
 void setShake(int strength, int speed, int fallOfSpeed)
          Set parameters for shaking the surface.
 void setSketch(Sketch sketch)
           
 void setSurfaceMask(processing.core.PImage mask)
           
 void setSurfaceName(String surfaceName)
          Sets the name of the surface
 void setTextureWindow(float x, float y, float width, float height)
          Manually set coordinates for mapping the texture.
 void setZ(float currentZ)
          Set Z-displacement for all coordinates of surface
 void shake()
          Tells surface to shake (will only do something if setShake has been called quite recently)
 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)
 void toggleMode()
          Toggle surface mode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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.


clearSurfaceMask

public void clearSurfaceMask()
Specified by:
clearSurfaceMask in interface SuperSurface

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

decreaseResolution

public void decreaseResolution()
Decrease the subdivision

Specified by:
decreaseResolution 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

getBezierPoint

public Point3D getBezierPoint(int index)
Description copied from interface: SuperSurface
Get target Bezier control point

Specified by:
getBezierPoint in interface SuperSurface
Returns:

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:

getCornerPoints

public Point3D[] getCornerPoints()
Get all corners

Specified by:
getCornerPoints in interface SuperSurface
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:

getMaskFile

public File getMaskFile()
Specified by:
getMaskFile in interface SuperSurface

getPolygon

public Polygon getPolygon()
Get the surface as a polygon

Specified by:
getPolygon 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:

getSketch

public Sketch getSketch()
Specified by:
getSketch in interface SuperSurface

getSurfaceMask

public processing.core.PImage getSurfaceMask()
Specified by:
getSurfaceMask in interface SuperSurface

getSurfaceName

public String getSurfaceName()
Specified by:
getSurfaceName in interface SuperSurface

getSurfaceType

public int getSurfaceType()
Description copied from interface: SuperSurface
See which type this surface is

Specified by:
getSurfaceType in interface SuperSurface
Returns:

getTextureWindow

public processing.core.PVector[] getTextureWindow()
Specified by:
getTextureWindow in interface SuperSurface

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

increaseResolution

public void increaseResolution()
Increase the subdivision

Specified by:
increaseResolution 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:

isUsingSurfaceMask

public boolean isUsingSurfaceMask()
Specified by:
isUsingSurfaceMask in interface SuperSurface

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 -

setMaskFile

public void setMaskFile(File maskFile)
Specified by:
setMaskFile in interface SuperSurface

setModeCalibrate

public void setModeCalibrate()
Description copied from interface: SuperSurface
Set surface to calibration mode

Specified by:
setModeCalibrate in interface SuperSurface

setModeRender

public void setModeRender()
Description copied from interface: SuperSurface
Set surface to render mode

Specified by:
setModeRender in interface SuperSurface

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 -

setSketch

public void setSketch(Sketch sketch)
Specified by:
setSketch in interface SuperSurface

setSurfaceMask

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

setSurfaceName

public void setSurfaceName(String surfaceName)
Description copied from interface: SuperSurface
Sets the name of the surface

Specified by:
setSurfaceName 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 -

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

toggleMode

public void toggleMode()
Description copied from interface: SuperSurface
Toggle surface mode

Specified by:
toggleMode in interface SuperSurface


Copyright © 2016. All rights reserved.