Package ixagon.surface.mapper
Class BezierSurface
- java.lang.Object
-
- ixagon.surface.mapper.BezierSurface
-
- All Implemented Interfaces:
SuperSurface
public class BezierSurface extends Object implements SuperSurface
-
-
Field Summary
-
Fields inherited from interface ixagon.surface.mapper.SuperSurface
BEZIER, DEFAULT_SIZE, QUAD
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearSurfaceMask()voiddecreaseHorizontalForce()Decrease the amount of horizontal displacement force used for spherical mapping for bezier surfaces.voiddecreaseResolution()Decrease the subdivisionvoiddecreaseVerticalForce()Decrease the amount of vertical displacement force used for spherical mapping for bezier surfaces.intgetActiveBezierPointIndex(int mX, int mY)Returns index 0-7 if coordinates are on a bezier controlintgetActiveCornerPointIndex(int mX, int mY)Returns index 0-3 if coordinates are near a corner or index 4 if on a surfaceintgetActivePoint()Get the index of active corner (or surface)doublegetArea()Calculates and returns the surfaces area in squarepixels.Point3DgetBezierPoint(int index)Get the target bezier pointPoint3D[]getBezierPoints()Get all bezier pointsfloatgetBlendLeftSize()Get the width of the left edge blendfloatgetBlendRightSize()Get the width of the right edge blendintgetBufferScreenWidth()Point3DgetCenter()Get the average center point of the surfaceintgetColor()Get the fill color of the surface in calibration modePoint3DgetCornerPoint(int index)Get the target corner pointPoint3D[]getCornerPoints()Get all corner pointsintgetHorizontalForce()Get the amount of horizontal displacement force used for spherical mapping for bezier surfaces.intgetId()Get the surfaces IDbooleangetLocked()See if the surface is lockeddoublegetLongestSide()Get the longest side as doubleFilegetMaskFile()PolygongetPolygon()Get the surfaces polygonintgetRes()Get the amount of subdivision used in the surfaceintgetSelectedBezierControl()Get the currently selected bezier controlintgetSelectedCorner()Get the currently selected cornerSketchgetSketch()intgetSketchIndex()Get the actual sketch index.processing.core.PImagegetSurfaceMask()StringgetSurfaceName()intgetSurfaceType()See which type this surface isprocessing.core.PVector[]getTextureWindow()intgetVerticalForce()Get the amount of vertical displacement force used for spherical mapping for bezier surfaces.voidincreaseHorizontalForce()Increase the amount of horizontal displacement force used for spherical mapping for bezier surfaces.voidincreaseResolution()Increase the subdivisionvoidincreaseVerticalForce()Increase the amount of vertical displacement force used for spherical mapping for bezier surfaces.booleanisBlendLeft()See if the surface has been set to blend on the leftbooleanisBlendRight()See if the surface has been set to blend on the rightbooleanisCornerMovementAllowed()See if we can move the cornerpoint of the surfacebooleanisHidden()See if surface is hiddenbooleanisInside(float mX, float mY)Returns true if coordinates are inside a surfacebooleanisLocked()See if the surface is lockedbooleanisSelected()See if the surface is selectedbooleanisUsingEdgeBlend()See if the surface is using edge blendbooleanisUsingSurfaceMask()voidrender(processing.core.PGraphics g)Render method for rendering while in calibration modevoidrender(processing.core.PGraphics g, processing.core.PImage tex)Render method for rendering in RENDER mode.voidrotateCornerPoints(int direction)Rotate the cornerpoints in direction (0=ClockWise 1=CounterClockWise)Point3DscreenCoordinatesToQuad(float x, float y)Translates a point on the screen into a point in the surface.voidsetActivePoint(int activePoint)Set index of which corner is activevoidsetBezierPoint(int pointIndex, float x, float y)Set target bezier control point to coordinatesvoidsetBlendLeft(boolean blendLeft)Set if the left side should be blendedvoidsetBlendLeftSize(float blendLeftSize)Set the width of the left edge blendvoidsetBlendRight(boolean blendRight)Set if the right side should be blendedvoidsetBlendRightSize(float blendRightSize)Set the width of the right edge blendvoidsetBufferScreenWidth(int bufferScreenWidth)Set the width of the buffer offscreenvoidsetColor(int ccolor)Sets the fill color of the surface in calibration modevoidsetCornerPoint(int pointIndex, float x, float y)Set target corner point to coordinatesvoidsetCornerPoints(float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3)Manually set coordinates for all corners of the surfacevoidsetHide(boolean hidden)Set if the surface should be hiddenvoidsetId(int id)Set the surfaces IDvoidsetLocked(boolean isLocked)Set if the surface is lockedvoidsetMaskFile(File maskFile)voidsetModeCalibrate()Set surface to calibration modevoidsetModeRender()Set surface to render modevoidsetSelected(boolean selected)Set if the surface is selectedvoidsetSelectedBezierControl(int selectedBezierControl)Set target bezier control to selectedvoidsetSelectedCorner(int selectedCorner)Set target corner to selectedvoidsetShake(int strength, int speed, int fallOfSpeed)Set parameters for shaking the surface.voidsetSketch(Sketch sketch)voidsetSketchIndex(int sketchIndex)Set the actual sketch index.voidsetSurfaceMask(processing.core.PImage mask)voidsetSurfaceName(String surfaceName)Sets the name of the surfacevoidsetTextureWindow(float x, float y, float width, float height)Manually set coordinates for mapping the texture.voidsetZ(float currentZ)Set Z-displacement for all coordinates of surfacevoidshake()Tells surface to shake (will only do something if setShake has been called quite recently)voidtoggleLocked()Toggle if surface is lockedvoidtoggleMode()Toggle surface modevoidupdateTransform()Recalculates all coordinates of the surface.
-
-
-
Method Detail
-
clearSurfaceMask
public void clearSurfaceMask()
- Specified by:
clearSurfaceMaskin interfaceSuperSurface
-
decreaseHorizontalForce
public void decreaseHorizontalForce()
Decrease the amount of horizontal displacement force used for spherical mapping for bezier surfaces. (using orthographic projection)- Specified by:
decreaseHorizontalForcein interfaceSuperSurface
-
decreaseResolution
public void decreaseResolution()
Decrease the subdivision- Specified by:
decreaseResolutionin interfaceSuperSurface
-
decreaseVerticalForce
public void decreaseVerticalForce()
Decrease the amount of vertical displacement force used for spherical mapping for bezier surfaces. (using orthographic projection)- Specified by:
decreaseVerticalForcein interfaceSuperSurface
-
getActiveBezierPointIndex
public int getActiveBezierPointIndex(int mX, int mY)Returns index 0-7 if coordinates are on a bezier control- Specified by:
getActiveBezierPointIndexin interfaceSuperSurface- Parameters:
mX-mY-- Returns:
-
getActiveCornerPointIndex
public int getActiveCornerPointIndex(int mX, int mY)Returns index 0-3 if coordinates are near a corner or index 4 if on a surface- Specified by:
getActiveCornerPointIndexin interfaceSuperSurface- Parameters:
mX-mY-- Returns:
-
getActivePoint
public int getActivePoint()
Get the index of active corner (or surface)- Specified by:
getActivePointin interfaceSuperSurface- Returns:
-
getArea
public double getArea()
Description copied from interface:SuperSurfaceCalculates and returns the surfaces area in squarepixels.- Specified by:
getAreain interfaceSuperSurface- Returns:
-
getBezierPoint
public Point3D getBezierPoint(int index)
Get the target bezier point- Specified by:
getBezierPointin interfaceSuperSurface- Parameters:
index-- Returns:
-
getBezierPoints
public Point3D[] getBezierPoints()
Get all bezier points- Returns:
-
getBlendLeftSize
public float getBlendLeftSize()
Description copied from interface:SuperSurfaceGet the width of the left edge blend- Specified by:
getBlendLeftSizein interfaceSuperSurface- Returns:
-
getBlendRightSize
public float getBlendRightSize()
Description copied from interface:SuperSurfaceGet the width of the right edge blend- Specified by:
getBlendRightSizein interfaceSuperSurface- Returns:
-
getBufferScreenWidth
public int getBufferScreenWidth()
-
getCenter
public Point3D getCenter()
Get the average center point of the surface- Specified by:
getCenterin interfaceSuperSurface- Returns:
-
getColor
public int getColor()
Get the fill color of the surface in calibration mode- Specified by:
getColorin interfaceSuperSurface- Returns:
-
getCornerPoint
public Point3D getCornerPoint(int index)
Get the target corner point- Specified by:
getCornerPointin interfaceSuperSurface- Parameters:
index-- Returns:
-
getCornerPoints
public Point3D[] getCornerPoints()
Get all corner points- Specified by:
getCornerPointsin interfaceSuperSurface- Returns:
-
getHorizontalForce
public int getHorizontalForce()
Get the amount of horizontal displacement force used for spherical mapping for bezier surfaces.- Specified by:
getHorizontalForcein interfaceSuperSurface- Returns:
-
getId
public int getId()
Get the surfaces ID- Specified by:
getIdin interfaceSuperSurface- Returns:
-
getLocked
public boolean getLocked()
See if the surface is locked- Returns:
-
getLongestSide
public double getLongestSide()
Get the longest side as double- Specified by:
getLongestSidein interfaceSuperSurface- Returns:
-
getMaskFile
public File getMaskFile()
- Specified by:
getMaskFilein interfaceSuperSurface
-
getPolygon
public Polygon getPolygon()
Get the surfaces polygon- Specified by:
getPolygonin interfaceSuperSurface- Returns:
-
getRes
public int getRes()
Get the amount of subdivision used in the surface- Specified by:
getResin interfaceSuperSurface- Returns:
-
getSelectedBezierControl
public int getSelectedBezierControl()
Get the currently selected bezier control- Specified by:
getSelectedBezierControlin interfaceSuperSurface- Returns:
-
getSelectedCorner
public int getSelectedCorner()
Get the currently selected corner- Specified by:
getSelectedCornerin interfaceSuperSurface- Returns:
-
getSketch
public Sketch getSketch()
- Specified by:
getSketchin interfaceSuperSurface
-
getSurfaceMask
public processing.core.PImage getSurfaceMask()
- Specified by:
getSurfaceMaskin interfaceSuperSurface
-
getSurfaceName
public String getSurfaceName()
- Specified by:
getSurfaceNamein interfaceSuperSurface
-
getSurfaceType
public int getSurfaceType()
Description copied from interface:SuperSurfaceSee which type this surface is- Specified by:
getSurfaceTypein interfaceSuperSurface- Returns:
-
getTextureWindow
public processing.core.PVector[] getTextureWindow()
- Specified by:
getTextureWindowin interfaceSuperSurface
-
getVerticalForce
public int getVerticalForce()
Get the amount of vertical displacement force used for spherical mapping for bezier surfaces.- Specified by:
getVerticalForcein interfaceSuperSurface- Returns:
-
increaseHorizontalForce
public void increaseHorizontalForce()
Increase the amount of horizontal displacement force used for spherical mapping for bezier surfaces. (using orthographic projection)- Specified by:
increaseHorizontalForcein interfaceSuperSurface
-
increaseResolution
public void increaseResolution()
Increase the subdivision- Specified by:
increaseResolutionin interfaceSuperSurface
-
increaseVerticalForce
public void increaseVerticalForce()
Increase the amount of vertical displacement force used for spherical mapping for bezier surfaces. (using orthographic projection)- Specified by:
increaseVerticalForcein interfaceSuperSurface
-
isBlendLeft
public boolean isBlendLeft()
Description copied from interface:SuperSurfaceSee if the surface has been set to blend on the left- Specified by:
isBlendLeftin interfaceSuperSurface- Returns:
-
isBlendRight
public boolean isBlendRight()
Description copied from interface:SuperSurfaceSee if the surface has been set to blend on the right- Specified by:
isBlendRightin interfaceSuperSurface- Returns:
-
isCornerMovementAllowed
public boolean isCornerMovementAllowed()
Description copied from interface:SuperSurfaceSee if we can move the cornerpoint of the surface- Specified by:
isCornerMovementAllowedin interfaceSuperSurface- Returns:
-
isHidden
public boolean isHidden()
See if surface is hidden- Specified by:
isHiddenin interfaceSuperSurface- Returns:
-
isInside
public boolean isInside(float mX, float mY)Returns true if coordinates are inside a surface- Specified by:
isInsidein interfaceSuperSurface- Parameters:
mX-mY-- Returns:
-
isLocked
public boolean isLocked()
Description copied from interface:SuperSurfaceSee if the surface is locked- Specified by:
isLockedin interfaceSuperSurface- Returns:
-
isSelected
public boolean isSelected()
See if the surface is selected- Specified by:
isSelectedin interfaceSuperSurface- Returns:
-
isUsingEdgeBlend
public boolean isUsingEdgeBlend()
Description copied from interface:SuperSurfaceSee if the surface is using edge blend- Specified by:
isUsingEdgeBlendin interfaceSuperSurface- Returns:
-
isUsingSurfaceMask
public boolean isUsingSurfaceMask()
- Specified by:
isUsingSurfaceMaskin interfaceSuperSurface
-
render
public void render(processing.core.PGraphics g)
Render method for rendering while in calibration mode- Specified by:
renderin interfaceSuperSurface- 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:
renderin interfaceSuperSurface- Parameters:
g-tex-
-
rotateCornerPoints
public void rotateCornerPoints(int direction)
Rotate the cornerpoints in direction (0=ClockWise 1=CounterClockWise)- Specified by:
rotateCornerPointsin interfaceSuperSurface- Parameters:
direction-
-
screenCoordinatesToQuad
public Point3D screenCoordinatesToQuad(float x, float y)
Translates a point on the screen into a point in the surface. (not implemented in Bezier Surfaces yet)- Specified by:
screenCoordinatesToQuadin interfaceSuperSurface- Parameters:
x-y-- Returns:
-
setActivePoint
public void setActivePoint(int activePoint)
Set index of which corner is active- Specified by:
setActivePointin interfaceSuperSurface- Parameters:
activePoint-
-
setBezierPoint
public void setBezierPoint(int pointIndex, float x, float y)Set target bezier control point to coordinates- Specified by:
setBezierPointin interfaceSuperSurface- Parameters:
pointIndex-x-y-
-
setBlendLeft
public void setBlendLeft(boolean blendLeft)
Description copied from interface:SuperSurfaceSet if the left side should be blended- Specified by:
setBlendLeftin interfaceSuperSurface
-
setBlendLeftSize
public void setBlendLeftSize(float blendLeftSize)
Description copied from interface:SuperSurfaceSet the width of the left edge blend- Specified by:
setBlendLeftSizein interfaceSuperSurface
-
setBlendRight
public void setBlendRight(boolean blendRight)
Description copied from interface:SuperSurfaceSet if the right side should be blended- Specified by:
setBlendRightin interfaceSuperSurface
-
setBlendRightSize
public void setBlendRightSize(float blendRightSize)
Description copied from interface:SuperSurfaceSet the width of the right edge blend- Specified by:
setBlendRightSizein interfaceSuperSurface
-
setBufferScreenWidth
public void setBufferScreenWidth(int bufferScreenWidth)
Description copied from interface:SuperSurfaceSet the width of the buffer offscreen- Specified by:
setBufferScreenWidthin interfaceSuperSurface
-
setColor
public void setColor(int ccolor)
Sets the fill color of the surface in calibration mode- Specified by:
setColorin interfaceSuperSurface- Parameters:
ccolor-
-
setCornerPoint
public void setCornerPoint(int pointIndex, float x, float y)Set target corner point to coordinates- Specified by:
setCornerPointin interfaceSuperSurface- Parameters:
pointIndex-x-y-
-
setCornerPoints
public void setCornerPoints(float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3)Manually set coordinates for all corners of the surface- Specified by:
setCornerPointsin interfaceSuperSurface- Parameters:
x0-y0-x1-y1-x2-y2-x3-y3-
-
setHide
public void setHide(boolean hidden)
Set if the surface should be hidden- Specified by:
setHidein interfaceSuperSurface- Parameters:
hidden-
-
setId
public void setId(int id)
Set the surfaces ID- Specified by:
setIdin interfaceSuperSurface- Parameters:
id-
-
setLocked
public void setLocked(boolean isLocked)
Set if the surface is locked- Specified by:
setLockedin interfaceSuperSurface- Parameters:
isLocked-
-
setMaskFile
public void setMaskFile(File maskFile)
- Specified by:
setMaskFilein interfaceSuperSurface
-
setModeCalibrate
public void setModeCalibrate()
Set surface to calibration mode- Specified by:
setModeCalibratein interfaceSuperSurface
-
setModeRender
public void setModeRender()
Set surface to render mode- Specified by:
setModeRenderin interfaceSuperSurface
-
setSelected
public void setSelected(boolean selected)
Set if the surface is selected- Specified by:
setSelectedin interfaceSuperSurface- Parameters:
selected-
-
setSelectedBezierControl
public void setSelectedBezierControl(int selectedBezierControl)
Set target bezier control to selected- Specified by:
setSelectedBezierControlin interfaceSuperSurface- Parameters:
selectedBezierControl-
-
setSelectedCorner
public void setSelectedCorner(int selectedCorner)
Set target corner to selected- Specified by:
setSelectedCornerin interfaceSuperSurface- 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:
setShakein interfaceSuperSurface- Parameters:
strength-speed-fallOfSpeed-
-
setSketch
public void setSketch(Sketch sketch)
- Specified by:
setSketchin interfaceSuperSurface
-
setSurfaceMask
public void setSurfaceMask(processing.core.PImage mask)
- Specified by:
setSurfaceMaskin interfaceSuperSurface
-
setSurfaceName
public void setSurfaceName(String surfaceName)
Description copied from interface:SuperSurfaceSets the name of the surface- Specified by:
setSurfaceNamein interfaceSuperSurface
-
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:
setTextureWindowin interfaceSuperSurface
-
setZ
public void setZ(float currentZ)
Set Z-displacement for all coordinates of surface- Specified by:
setZin interfaceSuperSurface- Parameters:
currentZ-
-
getSketchIndex
public int getSketchIndex()
Description copied from interface:SuperSurfaceGet the actual sketch index.- Specified by:
getSketchIndexin interfaceSuperSurface
-
setSketchIndex
public void setSketchIndex(int sketchIndex)
Description copied from interface:SuperSurfaceSet the actual sketch index.- Specified by:
setSketchIndexin interfaceSuperSurface
-
shake
public void shake()
Tells surface to shake (will only do something if setShake has been called quite recently)- Specified by:
shakein interfaceSuperSurface
-
toggleLocked
public void toggleLocked()
Toggle if surface is locked- Specified by:
toggleLockedin interfaceSuperSurface
-
toggleMode
public void toggleMode()
Toggle surface mode- Specified by:
toggleModein interfaceSuperSurface
-
updateTransform
public void updateTransform()
Recalculates all coordinates of the surface. Must be called whenever any change has been done to the surface.
-
-