Sofia API Reference

  • Package Index
  • Class Index
  • Packages
  • sofia.app
  • sofia.content
  • sofia.data
  • sofia.graphics
    • Interfaces
    • Joint
    • PropertyTransformer
    • Classes
    • AbstractJoint
    • Anchor
    • Color
    • CoordinateSystem
    • DirectionalPad
    • DistanceJoint
    • ElasticInInterpolator
    • ElasticInOutInterpolator
    • ElasticOutInterpolator
    • FillableShape
    • FillableShape.Animator
    • Geometry
    • Image
    • LineShape
    • MotionStep
    • OvalShape
    • PointAndAnchor
    • Polygon
    • PolygonShape
    • Predicate
    • RectangleShape
    • RevoluteJoint
    • Shape
    • Shape.Animator
    • Shape.Filter
    • ShapeField
    • ShapeFilter
    • ShapeSet
    • ShapeView
    • SizeF
    • StrokedShape
    • StrokedShape.Animator
    • TextShape
    • TextShape.Animator
    • Timings
    • ViewEdges
    • ZIndexComparator
    • Enums
    • RepeatMode
    • ShapeMotion
  • sofia.util
  • sofia.view
  • sofia.widget

public interface
Joint

Inheritance

  • sofia.graphics.Joint
Known Indirect Subclasses
AbstractJoint<JointType extends Joint, JointDefType extends JointDef>, DistanceJoint, RevoluteJoint
AbstractJoint<JointType extends Joint, JointDefType extends JointDef> The abstract base class for all Sofia classes representing JBox2D joints. 
DistanceJoint A joint that forces the distance between two shapes to always remain constant, or within a certain amount of each other (like a spring-damper). 
RevoluteJoint A joint that forces two shapes to share a common anchor point, allowing only the relative rotation between them to change. 

Class Overview

An interface that represents joints between shapes. This allows users to polymorphically refer to joints without dealing with the generic parameters used by AbstractJoint.

Essentially, this interface only provides capabilities to retrieve the shapes used by the joint, connect/disconnect them, and retrieve the underlying JBox2D joint objects (for advanced usage). Any more specific capabilities will require downcasting to the concrete joint type.


Summary

Public Methods
abstract void connect()
Activates the joint.
abstract void disconnect()
Deactivates the joint, releasing the connection between the two shapes.
abstract org.jbox2d.dynamics.joints.Joint getB2Joint()
Gets the underlying JBox2D joint object.
abstract org.jbox2d.dynamics.joints.JointDef getB2JointDef()
Gets the underlying JBox2D joint definition object.
abstract Shape getFirstShape()
Gets the first shape connected by this joint.
abstract Shape getSecondShape()
Gets the second shape connected by this joint.

Public Methods

public abstract void connect ()

Activates the joint. You must call this method after creating the joint object if you want it to have any effect.

public abstract void disconnect ()

Deactivates the joint, releasing the connection between the two shapes.

public abstract org.jbox2d.dynamics.joints.Joint getB2Joint ()

Gets the underlying JBox2D joint object. For advanced usage only.

Returns

the underlying JBox2D joint object

public abstract org.jbox2d.dynamics.joints.JointDef getB2JointDef ()

Gets the underlying JBox2D joint definition object. For advanced usage only.

Returns

the underlying JBox2D joint definition object

public abstract Shape getFirstShape ()

Gets the first shape connected by this joint.

Returns

the first shape connected by this joint

public abstract Shape getSecondShape ()

Gets the second shape connected by this joint.

Returns

the second shape connected by this joint