当前位置: 首页>>代码示例>>Java>>正文


Java Vector2d.sub方法代码示例

本文整理汇总了Java中javax.vecmath.Vector2d.sub方法的典型用法代码示例。如果您正苦于以下问题:Java Vector2d.sub方法的具体用法?Java Vector2d.sub怎么用?Java Vector2d.sub使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.vecmath.Vector2d的用法示例。


在下文中一共展示了Vector2d.sub方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: adjacentDist

import javax.vecmath.Vector2d; //导入方法依赖的package包/类
public double adjacentDist(Line l, Point2d pt) {

		Vector2d v1 = new Vector2d(l.end);
		v1.sub(l.start);
		Vector2d v2 = new Vector2d(pt);
		v2.sub(l.start);
		double param = v2.dot(v1) / v1.length();

		if ( param < 0 || param > v1.length() )
			return Double.MAX_VALUE;
		
		v1.normalize();
		v1.scale( param );
		v1.add( l.start );
		
		return new Point2d (v1).distance(pt);
	}
 
开发者ID:twak,项目名称:chordatlas,代码行数:18,代码来源:FacadeFinder.java

示例2: project

import javax.vecmath.Vector2d; //导入方法依赖的package包/类
public static Point2d project(Line l, Point2d pt) {
	
	Vector2d v1 = new Vector2d(l.end);
	v1.sub(l.start);
	Vector2d v2 = new Vector2d(pt);
	v2.sub(l.start);
	double param = v2.dot(v1) / v1.length();

	if (param < 0 || param > v1.length())
		return null;

	v1.normalize();
	v1.scale(param);
	v1.add(l.start);

	return new Point2d(v1);
}
 
开发者ID:twak,项目名称:chordatlas,代码行数:18,代码来源:Concarnie.java

示例3: findNeighbours

import javax.vecmath.Vector2d; //导入方法依赖的package包/类
private void findNeighbours( List<FRect> list ) {

		for ( FRect a : list )
			for ( Dir d : Dir.values() ) {

				FRect best = null;
				double bestDist = Double.MAX_VALUE;
				Vector2d wDir = d.dir();
				
				for ( FRect b : list ) {
					
					if ( b == a )
						continue;

					Vector2d delta = new Vector2d(b.getCenter());
					delta.sub (a.getCenter());
					
					if (wDir.angle( delta ) > Mathz.PI6 )
						continue;
					
					double dist = a.getCenter().distanceSquared( b.getCenter() );

					if ( dist < bestDist ) {
						bestDist = dist;
						best = b;
					}
				}

				a.setAdj( d, best );
			}
	}
 
开发者ID:twak,项目名称:chordatlas,代码行数:32,代码来源:Regularizer.java

示例4: extrude

import javax.vecmath.Vector2d; //导入方法依赖的package包/类
public static void extrude( ObjDump out, LoopL<Point2d> slice, double h1, double h2 ) {
		 
		for (Loop<Point2d> loop : slice) {

			for (Loopable<Point2d> pt : loop.loopableIterator()) {
				
				List<double[]> pts = new ArrayList<>(),
						norms = new ArrayList<>();
				
				Point2d a = pt.get(), b = pt.getNext().get();

				pts.add( new double[] { a.x, h1, a.y} );
				pts.add( new double[] { b.x, h1, b.y} );
				pts.add( new double[] { b.x, h2, b.y} );
				pts.add( new double[] { a.x, h2, a.y} );
				
				Vector2d d = new Vector2d( b);
				d.sub(a);
				d.normalize();
				
				double[] norm = new double[] {-d.y, 0, d.x};
//				double[] norm = new double[] {d.y, 0, -d.x};
				
				for (int i = 0; i < 4; i++)
					norms.add(norm);
				
				out.addFace(pts.toArray( new double[pts.size()][] ), null, norms.toArray( new double[norms.size()][] ));
			}
		}
	}
 
开发者ID:twak,项目名称:chordatlas,代码行数:31,代码来源:Slice.java

示例5: drawAimAPI

import javax.vecmath.Vector2d; //导入方法依赖的package包/类
public void drawAimAPI(Graphics2D g, int playerIndex, int distance) {
    if(getGameCanvas().requestedAimAPI() && playerIndex >= 0 && playerIndex < Team.MAX_TEAM_SIZE && distance > 0) {
        Team aimingTeam = isLeft() ? getClient().getMatch().getTeam(0) : getClient().getMatch().getTeam(1);

        if(aimingTeam != null) {
            Player aimingPlayer = aimingTeam.getPlayers().get(playerIndex);

            if(aimingPlayer != null) {
                Vector2d aimingPlayerPos = (Vector2d) aimingPlayer.getPos().clone();

                if(aimingPlayerPos != null) {
                    Vector2d dist = new Vector2d(getGameCanvas().getPitchMouseLogic().getMXY()[0], getGameCanvas().getPitchMouseLogic().getMXY()[1]);
                    dist.sub(aimingPlayerPos);

                    if(dist.length() <= distance) {
                        Color paint = SBColor.YELLOW;
                        if(aimingFieldDistanceClass == 1) paint = SBColor.ORANGE_BRIGHT;
                        if(aimingFieldDistanceClass == 2) paint = SBColor.ORANGE_DARK;
                        if(aimingFieldDistanceClass == 3) paint = SBColor.RED;
                        drawCurveToMouse(g, aimingPlayerPos, paint);

                        paint = SBColor.YELLOW_80;
                        if(aimingFieldDistanceClass == 1) paint = SBColor.ORANGE_BRIGHT_80;
                        if(aimingFieldDistanceClass == 2) paint = SBColor.ORANGE_DARK_80;
                        if(aimingFieldDistanceClass == 3) paint = SBColor.RED_80;
                        if(getGameCanvas().getPitchMouseLogic() != null)
                            if(getGameCanvas().getPitchMouseLogic().getFieldAimingAt() != null)
                                highlightField(g, getGameCanvas().getPitchMouseLogic().getFieldAimingAt().getPos().x, getGameCanvas().getPitchMouseLogic().getFieldAimingAt().getPos().y, paint);
                    }
                }
            }
        }

    }
}
 
开发者ID:milanvanzanten,项目名称:SafariBowl,代码行数:36,代码来源:GameRenderer.java

示例6: apply

import javax.vecmath.Vector2d; //导入方法依赖的package包/类
/**
 * the main method
 * @param message The message that caused this rule to be applied.
 * @param destination The pitch field to throw the ball to.
 */
public void apply(SBProtocolMessage message, PitchField destination) {
	if(actor.invokeGetRemainingBe() == 0 && !(actor.getTeam().getMovingPlayer() == actor)){
		sendMessageShowMe(actor.getTeam().getCoach(), actor.toString(), RuleMove.I_AM_EXHAUSTED);
		returnFailureMessage(message, SBProtocolMessage.FAILD_YOU_ARE_EXHAUSTED);
		return;
	}
	checkForMovingPlayer(actor);
	if(actor.getMatch().getPitch().isOnField(actor.getPos()) && actor.invokeGetPlayerCondition() == PlayerCondition.FINE){
		if(actor.isHoldingBall()){
			if(actor.getTeam().getPass()){
				Vector2d destinationField = new Vector2d(destination.getPos());
				Vector2d actorField = new Vector2d(actor.getPos());
				Vector2d difference = new Vector2d(destinationField);
				difference.sub(actorField);
				double distance = Math.sqrt((difference.x)*(difference.x)+(difference.y)*(difference.y));
				int problems = -(actor.getMatch().getOpposingTeam(actor.getTeam()).getTacklezones(actor.getPos()));
				if(findThrowModificator(problems, distance) < 1000){//if 1000 or higher, then its to far away.
					askForInterception(message, destinationField, findThrowModificator(problems, distance));
				}else{returnFailureMessage(message, SBProtocolMessage.FAILD_TOO_FAR_AWAY);}
			}else{
				returnFailureMessage(message, SBProtocolMessage.FAILD_NO_PASS_LEFT);
			}
		}else{
			returnFailureMessage(message, SBProtocolMessage.FAILD_PLAYER_DOESNT_HOLD_THE_BALL);
		}
	}else{
		returnFailureMessage(message, SBProtocolMessage.FAILD_PLAYER_CANNOT_TAKE_ACTION);
	}
}
 
开发者ID:milanvanzanten,项目名称:SafariBowl,代码行数:35,代码来源:RuleThrow.java

示例7: updateMarkers

import javax.vecmath.Vector2d; //导入方法依赖的package包/类
public void updateMarkers( Bar b )
{
    for (Marker m : b.mould.getAnchorsReadOnly( b.start, b.end ) )
    {
        Vector2d dir = new Vector2d (b.end);
        dir.sub(b.start);
        
        dir.scale( Mathz.clamp( weights.get (b), 0.1, 0.9 ) );
        dir.add(b.start);
        m.set( dir );

        m.bar = b;
    }
}
 
开发者ID:twak,项目名称:campskeleton,代码行数:15,代码来源:WeightedPointEditor.java

示例8: add

import javax.vecmath.Vector2d; //导入方法依赖的package包/类
private void add(List<Marker> out, Point2d relStart, Point2d relEnd, Bar b, boolean rel)
{
    Vector2d delta = new Vector2d(relEnd);
    delta.sub(relStart);


    for (PMarker pm : generators)
    {
        if (pm.rel == rel)
        {
            Vector2d d2 = new Vector2d(delta);
            d2.scale(pm.param);
            d2.add(relStart);
            Marker o = new Marker();
            o.bar = b;
            o.set(d2);


            if (b != null)
            {
                o.bar = b;
            }

            out.add(o);
            o.generator = pm;
        }
    }
}
 
开发者ID:twak,项目名称:campskeleton,代码行数:29,代码来源:NaiveMould.java

示例9: createDormerWindowsFor

import javax.vecmath.Vector2d; //导入方法依赖的package包/类
public void createDormerWindowsFor(Bar b, double desiredSpacing )
{
    b.mould.clear();
    
    double length = b.length();
    int count = (int)(length /desiredSpacing);
    double delta = length / (count+1.);
    Vector2d v = new Vector2d (b.end);
    v.sub(b.start);
    v.normalize();
    v.scale(delta);
    
    for (int i = 1; i <= count; i++)
    {
        Vector2d loc = new Vector2d (v);
        loc.scale(i);
        loc.add(b.start);
        Marker m = new Marker();
        m.set(loc);
        m.bar = b;
        
        b.mould.create(m, null);

        Marker profM =  profileMarkers.get( profiles.get(b));


        if (profM != null) {
            Ship.Instance instance = ns.newInstance();
            instance.anchors = new Anchor[]{new Anchor(m.generator, profM.generator)};
        }
    }
}
 
开发者ID:twak,项目名称:siteplan,代码行数:33,代码来源:OverhangPlan.java

示例10: calculateOnPitch

import javax.vecmath.Vector2d; //导入方法依赖的package包/类
void calculateOnPitch(MouseEvent e) {
    if (!isMovingPlayer()) { // is not moving player
        setMXY(e);
    } else { // is moving player
        // some magic numbers
        double  x0 = mX * getpW() + getpW() / 2, y0 = mY * getpH() + getpH() / 2,
                a = 7*getpW()/8;
        Vector2d mouse = getGameCanvas().getGameRenderer().dispToPos(new Vector2d(e.getX(), e.getY()));
        double dx = mouse.x - x0, dy = mouse.y - y0;
        if ((dx < -a || dx > a) || (dy < -a || dy > a)) { // moved outside of action zone (ask milan what the heck that means)
            setMXY(e);
        }
    }

    if(mX >= 0 && mX < Pitch.PITCH_LENGTH && mY >= 0 && mY < Pitch.PITCH_WIDTH) {

        if (getPitch() != null && (mX != mXOld || mY != mYOld)) { // mouse is on different field and pitch exists
            if (isAiming()) { // is aiming...
                Vector2d dist = (Vector2d) getAimingPlayer().getPos().clone();
                if (!dist.equals(getPitch().getFields()[mX][mY].getPos())) { // ... but not on itself
                    dist.sub(new Vector2d(mX, mY));
                    if (dist.length() <= RuleThrow.LONG_BOMB) // distance is shorter than max
                        setFieldAimingAt(getPitch().getFields()[mX][mY]);
                } else { // ... but on itself
                    resetAimingPlayer();
                }
            } else { // is not aiming
                if (getPitch().getFields()[mX][mY].getPlayer() != null) { // there is a player on the hovered field
                    setHoveringPlayer(getPitch().getFields()[mX][mY].getPlayer());
                } else {
                    resetHoveringPlayer();
                }

                if (isMovingPlayer()) { // player was moved one field
                    if (!isHoveringPlayer() || getHoveringPlayer().equals(getMovingPlayer())) { // next field is empty or moved player stands on this field
                        if (getDrawingPath().getPath().get(getDrawingPath().getPath().size() - 1).getPos().equals(new Vector2d(mX, mY))) { // hovering last drawn field
                            resetFieldBlitzing();
                        }
                        if (getDrawingPath().getPath().size() > 1) { // path is longer than one field
                            if (getDrawingPath().getPath().get(getDrawingPath().getPath().size() - 2).getPos().equals(new Vector2d(mX, mY))) { // moved one field back
                                removeLastPathElement();
                            } else {
                                addPathElement();
                            }
                        } else if (getDrawingPath().getPath().size() == 1) {
                            addPathElement();
                        }
                    } else { // there is already a player on this field
                        PitchField potentialBlitzField = getPitch().getFields()[mX][mY];
                        if (!isHoveringOwnPlayer() && potentialBlitzField != null) // cannot blitz own player
                            if (getMovingPlayer().invokeGetRemainingBe() >= getDrawingPath().getPath().size() // if player has another move..
                                    && getMovingPlayer().getTeam().getBlitz() // .. and team can still blitz, or ..
                                    || getDrawingPath().getPath().size() <= 1 // .. player is blocking ..
                                    && getMovingPlayer().invokeGetRemainingBe() == getMovingPlayer().invokeGetBe()) // .. and has not moved yet
                                if (getPitch().isAdjacent(potentialBlitzField, getDrawingPath().getPath().get(getDrawingPath().getPath().size() - 1)))
                                    setFieldBlitzing(potentialBlitzField);
                    }
                }

            }
        }

    } else {
        resetAimingPlayer();
    }

    if(mYCoord >= getPitchHeight()) {
        resetHoveringPlayer();
        resetMovingPlayer();
        resetAimingPlayer();
    }
}
 
开发者ID:milanvanzanten,项目名称:SafariBowl,代码行数:73,代码来源:PitchMouseLogic.java

示例11: chosenDirection

import javax.vecmath.Vector2d; //导入方法依赖的package包/类
/**
 * tests weather the chosen direction to push your enemy is legal and then moves (or not)
 * @param defender the pushed person
 * @param message SBProtocolMessage
 * @param answer SBProtocolMessage
 */
public boolean chosenDirection(Player defender, SBProtocolMessage message, SBProtocolMessage answer, Player playerBackingUp, Vector2d posToBackUp){
	Vector2d actorField = new Vector2d(actor.getPos());
	Vector2d defenderField = new Vector2d(defender.getPos());
	Vector2d direction = new Vector2d(defenderField);
	direction.sub(actorField);
	Vector2d newDefenderField = new Vector2d(defenderField);
	
	int x;
	int y;
	try{
		x = Integer.parseInt(answer.getParameterContent(2));
		y = Integer.parseInt(answer.getParameterContent(3));
		}
	catch(NumberFormatException e){
		returnFailureMessage(message, SBProtocolMessage.FAILD_RECEIVED_WRONG_GAME_DATA);
		return false;
	}
	Vector2d walk = new Vector2d(x,y);
	walk.sub(defenderField);
	if(pushPossible(actor.getPosition(), defender.getPosition(), walk)){
		newDefenderField.add(walk);
	}else{
		returnFailureMessage(message, SBProtocolMessage.FAILD_WRONG_DIRECTION);
		getMatch().sendMessage(actor.getTeam().getCoach().getUID(), message);
		return true;
	}
	if(!(actor.getMatch().getPitch().isOnField(newDefenderField))){
		crowdBeatsUpPlayer(defender);
		returnSuccessMessage(message, SBProtocolMessage.WORKD_DEFENDER_PUSHED);
		actor.getMatch().setGamePhase(3);
		pushAllWaitingPlayers(message);
		((RulePush)playerBackingUp.getRule(2)).backUp(posToBackUp, message, playerBackingUp);
	}else if(actor.getMatch().getPitch().getFields()[(int)newDefenderField.x][(int)newDefenderField.y].getPlayer() == null){
		//liegt der ball auf dem feld? -> scatter
		if (getMatch().getPitch().getBallPos().x == (int)newDefenderField.x && getMatch().getPitch().getBallPos().y == (int)newDefenderField.y){
			Vector2d newBallPos = new Vector2d (actor.getMatch().getPitch().getBallPos());
			newBallPos.add(actor.getMatch().scatter());
			actor.getMatch().getPitch().setBallPos(newBallPos);
		}
		((ServerMatch)actor.getMatch()).addCurrentPlayersBeingPushed(defender);
		((ServerMatch)actor.getMatch()).addCurrentPlayerPositionsBeingPushed(newDefenderField);
		pushAllWaitingPlayers(message);
		actor.getMatch().setGamePhase(3);
		((RulePush)playerBackingUp.getRule(2)).backUp(posToBackUp, message, playerBackingUp);
	}else{
		Player newDefender = actor.getMatch().getPitch().getFields()[(int)newDefenderField.x][(int)newDefenderField.y].getPlayer();
		((ServerMatch)getMatch()).addCurrentHighlitedFields(newDefender.getPos());
		((RuleBlock)actor.getRule(1)).sendHighlightFields(((ServerMatch)getMatch()).getCurrentHighlitedFields());
		((ServerMatch)actor.getMatch()).addCurrentPlayersBeingPushed(defender);
		((ServerMatch)actor.getMatch()).addCurrentPlayerPositionsBeingPushed(newDefenderField);
		((RulePush)defender.getRule(2)).apply(message, newDefender, newDefender.getPosition(), answer.getUID(), playerBackingUp, posToBackUp);
		returnSuccessMessage(message, SBProtocolMessage.WORKD_DEFENDER_PUSHED, "NEXT PUSH?");
		return true;
	}
	return true;
}
 
开发者ID:milanvanzanten,项目名称:SafariBowl,代码行数:63,代码来源:RulePush.java

示例12: isDirectlyConnectedTo

import javax.vecmath.Vector2d; //导入方法依赖的package包/类
/**
 * Testet ob this mit p2 in der parcoursMapSimple auf direktem Wege vom Bot
 * erreicht werden koennen
 *
 * @param p2 Zu testender Punkt
 * @param parcoursMapSimple ParcoursMap
 * @return true wenn direkt erreichbar
 */
boolean isDirectlyConnectedTo(TurningPoint p2, int[][] parcoursMapSimple) {
	Vector2d direction = new Vector2d(p2.pos);
	direction.sub(this.pos);
	double rectL = (this.pos.x < p2.pos.x ? this.pos.x : p2.pos.x)
			- (1. + distFromCorner);
	double rectR = (this.pos.x > p2.pos.x ? this.pos.x : p2.pos.x)
			+ distFromCorner;
	double rectD = (this.pos.y < p2.pos.y ? this.pos.y : p2.pos.y)
			- (1. + distFromCorner);
	double rectU = (this.pos.y > p2.pos.y ? this.pos.y : p2.pos.y)
			+ distFromCorner;
	for (int x = 0; x < parcoursMapSimple.length; x++) {
		for (int y = 0; y < parcoursMapSimple[0].length; y++) {
			if (parcoursMapSimple[x][y] == 1 && x > rectL && x < rectR
					&& y > rectD && y < rectU) {
				Vector2d corner = new Vector2d(x - distFromCorner, y
						- distFromCorner);
				corner.sub(this.pos);
				double whichside = direction.x * corner.y - direction.y
						* corner.x;
				corner.set(x + (1. + distFromCorner), y - distFromCorner);
				corner.sub(this.pos);
				double sameside = direction.x * corner.y - direction.y
						* corner.x;
				if (whichside == 0)
					whichside = sameside;
				else if (sameside * whichside < 0)
					return false;
				corner.set(x + (1. + distFromCorner), y
						+ (1. + distFromCorner));
				corner.sub(this.pos);
				sameside = direction.x * corner.y - direction.y * corner.x;
				if (whichside == 0)
					whichside = sameside;
				else if (sameside * whichside < 0)
					return false;
				corner.set(x - distFromCorner, y + (1. + distFromCorner));
				corner.sub(this.pos);
				sameside = direction.x * corner.y - direction.y * corner.x;
				if (whichside == 0)
					whichside = sameside;
				else if (sameside * whichside < 0)
					return false;
			}
		}
	}
	return true;
}
 
开发者ID:tsandmann,项目名称:ct-sim,代码行数:57,代码来源:TurningPoint.java

示例13: returnLineTo

import javax.vecmath.Vector2d; //导入方法依赖的package包/类
/**
 * gibt einen Polygonzug der mit Breite und einer Spitze versehen Linie von
 * this zu p2 zurueck, zur Weiterverwendung in createLine()
 *
 * @param p2
 * @return {x1,y1,z1,x2,y2,z2,...,x6,y6,z6}
 */
float[] returnLineTo(TurningPoint p2) {
	Vector2d offset = new Vector2d(0.5, 0.5);
	Vector2d length = new Vector2d(p2.pos);
	length.sub(this.pos);
	Vector2d halfWidth = new Vector2d(-length.y, length.x);
	halfWidth.normalize();
	halfWidth.scale(lineWidth / 2);
	Vector2d corner = new Vector2d(this.pos);
	// corner.add(new Vector2d(0.5,0.5));
	corner.sub(halfWidth);
	corner.sub(offset);
	float[] polygon = new float[18];
	polygon[0] = (float) corner.x;
	polygon[1] = (float) corner.y;
	polygon[2] = height;
	corner.add(length);
	polygon[3] = (float) corner.x;
	polygon[4] = (float) corner.y;
	polygon[5] = height;
	corner.add(halfWidth);
	corner.add(halfWidth);
	polygon[6] = (float) corner.x;
	polygon[7] = (float) corner.y;
	polygon[8] = height;
	corner.sub(length);
	polygon[9] = (float) corner.x;
	polygon[10] = (float) corner.y;
	polygon[11] = height;
	corner.sub(halfWidth);
	Vector2d head = new Vector2d(length);
	head.normalize();
	head.scale(-lineWidth / 2);
	corner.add(head);
	polygon[12] = (float) corner.x;
	polygon[13] = (float) corner.y;
	polygon[14] = height;
	corner.sub(halfWidth);
	corner.sub(head);
	polygon[15] = (float) corner.x;
	polygon[16] = (float) corner.y;
	polygon[17] = height;
	return polygon;
}
 
开发者ID:tsandmann,项目名称:ct-sim,代码行数:51,代码来源:TurningPoint.java

示例14: setPlan

import javax.vecmath.Vector2d; //导入方法依赖的package包/类
private void setPlan(Marker planC, double distance, Marker planM) {
            
            // we always trail by 1 frame, but this can't really be helped.
            Bar bar = planC.bar;
//            Loop<Bar> loop = null;
//            Loopable<Bar> able = null;

            LoopLoopable<Bar>
                cAble = Siteplan.instance.plan.points.find( bar ),
                mAble = Siteplan.instance.plan.points.find( planM.bar );

            if ( cAble == null || mAble == null )
                return; // didn't find marker on main plan. give up.

            // remove plan marker from old location
            Object generator = planM.bar.mould.remove( planM );
            
            // anchors may have re-genereated. grab the most recent location
            planC = refresh (planC, cAble );
//            planM = refresh (planM, mAble);

//            Object generator = mAble.loopable.get().mould.remove( planM );

            // move plan marker - find correct bar by subtracting from desired distance

            double leftInBar;

            Loopable<Bar> able = cAble.loopable;

            if ( distance > 0 )
            {
                leftInBar = planC.distance( able.get().end );

                do
                    if ( leftInBar > distance )
                    {
                        leftInBar -= distance;
                        break;
                    }
                    else
                    {
                        distance -= leftInBar;
                        able = able.getNext();
                        leftInBar = able.get().length();
                    }
                while ( true );
            }
            else
            {
                distance = -distance;
                leftInBar = planC.distance( able.get().start );

                do
                    if ( leftInBar > distance )
                    {
                        leftInBar -= distance;
                        leftInBar = able.get().length() - leftInBar;
                        break;
                    }
                    else
                    {
                        distance -= leftInBar;
                        able = able.getPrev();
                        leftInBar = able.get().length();
                    }
                while ( true );
            }

            planM.bar = able.get();

            // calculate position as distance from end
            Vector2d dir = new Vector2d (planM.bar.end );
            dir.sub( planM.bar.start );
            dir.normalize();
            dir.scale( -leftInBar );
            dir.add( planM.bar.end );

            planM.set( dir );

            planM.bar.mould.create( planM, generator );
        }
 
开发者ID:twak,项目名称:siteplan,代码行数:82,代码来源:AnimateAnchorCircularShip.java

示例15: getDistanceTo

import javax.vecmath.Vector2d; //导入方法依赖的package包/类
/**
 * Euklidischer Abstand von this zu p2
 *
 * @param p2
 * @return Euklidischer Abstand von this zu p2
 */
double getDistanceTo(TurningPoint p2) {
	Vector2d h = new Vector2d(p2.pos);
	h.sub(this.pos);
	return h.length();
}
 
开发者ID:tsandmann,项目名称:ct-sim,代码行数:12,代码来源:TurningPoint.java


注:本文中的javax.vecmath.Vector2d.sub方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。