本文整理汇总了Java中edu.umd.cs.piccolo.util.PBounds.getMinY方法的典型用法代码示例。如果您正苦于以下问题:Java PBounds.getMinY方法的具体用法?Java PBounds.getMinY怎么用?Java PBounds.getMinY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.umd.cs.piccolo.util.PBounds
的用法示例。
在下文中一共展示了PBounds.getMinY方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setPositions
import edu.umd.cs.piccolo.util.PBounds; //导入方法依赖的package包/类
private void setPositions() {
PBounds parentBounds = parent.getBounds();
double buttonNodeX = parentBounds.getMaxX() - showHideButtonNode.getWidth() - DEFAULT_PADDING;
double buttonNodeY = parentBounds.getMinY() + DEFAULT_PADDING;
showHideButtonNode.setOffset(
buttonNodeX,
buttonNodeY
);
if ( showHideButtonNode.getParent() != null && showHideButtonNode.getParent().getChildrenReference().contains( showHideButtonNode ) ) {
showHideButtonNode.moveToFront();
}
restoreLabelNode.setOffset(
buttonNodeX - restoreLabelNode.getWidth() - DEFAULT_PADDING,
buttonNodeY
);
if ( restoreLabelNode.getParent() != null && restoreLabelNode.getParent().getChildrenReference().contains( restoreLabelNode ) ) {
restoreLabelNode.moveToFront();
}
}
示例2: step
import edu.umd.cs.piccolo.util.PBounds; //导入方法依赖的package包/类
public void step( MovingImageNode node, PBounds bounds ) {
double y = node.getYOffset() + node.getMotionDelta();
if ( y > bounds.getMaxY() ) {
y = bounds.getMinY() - node.getFullBoundsReference().getHeight();
}
node.setOffset( node.getXOffset(), y );
}
示例3: update
import edu.umd.cs.piccolo.util.PBounds; //导入方法依赖的package包/类
private void update() {
PBounds b = _foregroundNode.getFullBoundsReference();
double x = b.getMinX() - _insets.left;
double y = b.getMinY() - _insets.top;
double w = b.getWidth() + _insets.left + _insets.right;
double h = b.getHeight() + _insets.top + _insets.bottom;
_rectangle.setRect( x, y, w, h );
_pathNode.setPathTo( _rectangle );
}
示例4: separateMoleculeDestinations
import edu.umd.cs.piccolo.util.PBounds; //导入方法依赖的package包/类
/**
* Update atom destinations so that separate molecules will be separated visually
* <p/>
* Returns all of the molecules that were pushed in this action
*/
private Set<Molecule> separateMoleculeDestinations() {
int maxIterations = 500;
double pushAmount = 10; // how much to push two molecules away
Set<Molecule> pushedMolecules = new HashSet<Molecule>();
boolean foundOverlap = true;
while ( foundOverlap && maxIterations-- >= 0 ) {
foundOverlap = false;
for ( Molecule a : molecules ) {
PBounds aBounds = padMoleculeBounds( a.getDestinationBounds() );
// push it away from the outsides
if ( aBounds.getMinX() < getAvailablePlayAreaBounds().getMinX() ) {
a.shiftDestination( new Vector2D( getAvailablePlayAreaBounds().getMinX() - aBounds.getMinX(), 0 ) );
aBounds = padMoleculeBounds( a.getDestinationBounds() );
}
if ( aBounds.getMaxX() > getAvailablePlayAreaBounds().getMaxX() ) {
a.shiftDestination( new Vector2D( getAvailablePlayAreaBounds().getMaxX() - aBounds.getMaxX(), 0 ) );
aBounds = padMoleculeBounds( a.getDestinationBounds() );
}
if ( aBounds.getMinY() < getAvailablePlayAreaBounds().getMinY() ) {
a.shiftDestination( new Vector2D( 0, getAvailablePlayAreaBounds().getMinY() - aBounds.getMinY() ) );
aBounds = padMoleculeBounds( a.getDestinationBounds() );
}
if ( aBounds.getMaxY() > getAvailablePlayAreaBounds().getMaxY() ) {
a.shiftDestination( new Vector2D( 0, getAvailablePlayAreaBounds().getMaxY() - aBounds.getMaxY() ) );
}
// then separate it from other molecules
for ( Molecule b : molecules ) {
if ( a.getMoleculeId() >= b.getMoleculeId() ) {
// this removes the case where a == b, and will make sure we don't run the following code twice for (a,b) and (b,a)
continue;
}
PBounds bBounds = padMoleculeBounds( b.getDestinationBounds() );
if ( aBounds.intersects( bBounds ) ) {
foundOverlap = true;
// try adding both. set should remove duplicates
pushedMolecules.add( a );
pushedMolecules.add( b );
// get perturbed centers. this is so that if two molecules have the exact same centers, we will push them away
Vector2D aCenter = new Vector2D( aBounds.getCenter2D() ).plus( Math.random() - 0.5, Math.random() - 0.5 );
Vector2D bCenter = new Vector2D( bBounds.getCenter2D() ).plus( Math.random() - 0.5, Math.random() - 0.5 );
// delta from center of A to center of B, scaled to half of our push amount.
Vector2D delta = bCenter.minus( aCenter ).normalized().times( pushAmount );
// how hard B should be pushed (A will be pushed (1-pushRatio)). Heuristic, power is to make the ratio not too skewed
// this is done so that heavier molecules will be pushed less, while lighter ones will be pushed more
double pushPower = 1;
double pushRatio = Math.pow( a.getApproximateMolecularWeight(), pushPower ) / ( Math.pow( a.getApproximateMolecularWeight(), pushPower ) + Math.pow( b.getApproximateMolecularWeight(), pushPower ) );
// push B by the pushRatio
b.shiftDestination( delta.times( pushRatio ) );
// push A the opposite way, by (1 - pushRatio)
Vector2D delta1 = delta.times( -1 * ( 1 - pushRatio ) );
a.shiftDestination( delta1 );
aBounds = padMoleculeBounds( a.getDestinationBounds() );
}
}
}
}
return pushedMolecules;
}
示例5: isPointOutsideRadiusBounds
import edu.umd.cs.piccolo.util.PBounds; //导入方法依赖的package包/类
private static boolean isPointOutsideRadiusBounds( Vector2D point, double radius, PBounds bounds ) {
return point.x - radius < bounds.getMinX()
|| point.x + radius > bounds.getMaxX()
|| point.y - radius < bounds.getMinY()
|| point.y + radius > bounds.getMaxY();
}