Java 类javax.vecmath.Point2i 实例源码
项目:EnderPay
文件:BalanceHUD.java
private void drawBalance() {
mc.mcProfiler.startSection("balance");
ScaledResolution resolution = new ScaledResolution(mc);
FontRenderer fontRenderer = this.mc.getRenderManager().getFontRenderer();
//noinspection ConstantConditions //no, it is not constant
if (fontRenderer == null) return;
String text = (balance == null) ? "---" :
fontRenderer.listFormattedStringToWidth(Utils.format(balance) + getCurrency(), 64).get(0);
bind("enderpay:textures/icons.png");
Point2i position = EnderPay.settings.getPosition().getPoint(resolution, mc);
int x = position.getX() + EnderPay.settings.getxOffset();
int y = position.getY() + EnderPay.settings.getyOffset();
if (EnderPay.settings.getAnchor() != Anchor.LEFT) {
int textLength = fontRenderer.getStringWidth(text);
x -= (textLength + 18) / (EnderPay.settings.getAnchor() == Anchor.CENTRE ? 2 : 1);
}
drawTexturedModalRect(x, y, 0, 0, 16, 11);
drawString(fontRenderer, text, x + 18, y + 2, 0xa0a0a0);
mc.mcProfiler.endSection();
}
项目:ct-sim
文件:ThreeDBot.java
/**
* Aktualisiert das externe Modell
*/
@Override
public void updateExternalModel() {
double newValue = 0;
Point2i p = bot.getController().getWorld().transformWorldposToGlobalpos(getPositionInWorldCoord());
switch (coord) {
case X: newValue = p.x; break;
case Y: newValue = p.y; break;
case Z: break;
}
getExternalModel().setValue(newValue);
}
项目:jvircam
文件:Painter.java
public void paintImage(Mesh mesh, Graphics g) {
Point2i[] ar = new Point2i[mesh.getPoints().size()];
for (int i = 0; i < ar.length; i++) {
Point3d p = new Point3d(mesh.getPoint(i));
projection.transform(p);
ar[i] = new Point2i((int) p.x, (int) p.y);
}
g.setColor(Constants.Objects_Color);
for (Point3i tri : mesh.getTriangles()) {
g.drawLine(ar[tri.x].x, ar[tri.x].y, ar[tri.y].x, ar[tri.y].y);
g.drawLine(ar[tri.x].x, ar[tri.x].y, ar[tri.z].x, ar[tri.z].y);
g.drawLine(ar[tri.y].x, ar[tri.y].y, ar[tri.z].x, ar[tri.z].y);
}
}
项目:jvircam
文件:Camera.java
public Camera() {
this.position = new Vector3d(0, 0, 0);
this.rotation = new Matrix3d();
this.rotation.setIdentity();
this.focalLength = 10;
this.sensorSize = new Point2d(22.3, 14.9);
this.resolution = new Point2i(800, 600);//(5184, 3456);//
this.center = new Point2d(resolution.x / 2.0, resolution.y / 2.0);
this.projection = new Projection();
}
项目:jvircam
文件:Camera.java
public void setResolution(int rx, int ry) {
if (rx > 0 && ry > 0) {
this.resolution = new Point2i(rx, ry);
this.center = new Point2d(resolution.x / 2.0, resolution.y / 2.0);
} else {
throw new IllegalArgumentException();
}
}
项目:asura-j
文件:WorldObject.java
public WorldObject(WorldObjects type) {
this.type = type;
world = new Point2i();
team = new Point2i();
distFilter = new AverageFilter.Int(8);
headingFilter = new AverageFilter.Float(8);
}
项目:EnderPay
文件:EnderPayGuiConfig.java
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
super.drawScreen(mouseX, mouseY, partialTicks);
Position position = null;
Anchor anchor = null;
boolean fromServer = false;
int xOffset = 0;
int yOffset = 0;
for (int i = 0; i < this.entryList.getSize(); i++) {
GuiConfigEntries.IConfigEntry configEntry = this.entryList.getListEntry(i);
Object value = configEntry.getCurrentValue();
try {
switch (configEntry.getName()) {
case "anchorHUD":
if (value instanceof String) anchor = Anchor.byName((String) value);
break;
case "position":
if (value instanceof String) position = Position.byName((String) value);
break;
case "useGuiConfigFromServer":
if (value instanceof Boolean) fromServer = (Boolean) value;
break;
case "xOffset":
if (value instanceof String) xOffset = Integer.valueOf((String) value);
break;
case "yOffset":
if (value instanceof String) yOffset = Integer.valueOf((String) value);
break;
}
} catch (NumberFormatException ignored) {
}
}
ScaledResolution resolution = new ScaledResolution(mc);
Point2i point = null;
int hudWidth = 70;
int xOffsetAnchor = 0;
if (fromServer && EnderPay.settings instanceof SettingsClient) {
MessageSettings messageSettings = ((SettingsClient) EnderPay.settings).getMessage();
if (messageSettings == null) return;
point = messageSettings.getPosition().getPoint(resolution, mc);
xOffset = messageSettings.getxOffset();
yOffset = messageSettings.getyOffset();
if (messageSettings.getAnchor() != Anchor.LEFT) {
if (anchor == Anchor.RIGHT) xOffsetAnchor -= hudWidth;
else xOffsetAnchor -= hudWidth / 2;
}
}
if (!fromServer && position != null) {
point = position.getPoint(resolution, mc);
if (anchor != Anchor.LEFT) {
if (anchor == Anchor.RIGHT) xOffsetAnchor -= hudWidth;
else xOffsetAnchor -= hudWidth / 2;
}
}
if (point == null) return;
drawRect(point.getX() + xOffset + xOffsetAnchor, point.getY() + yOffset,
point.getX() + xOffset + hudWidth + xOffsetAnchor, point.getY() + yOffset + 14,
0x8800FF00);
drawRect(point.getX() + xOffset, point.getY() + yOffset,
point.getX() + xOffset + 14, point.getY() + yOffset + 14,
0x88FF0000);
}
项目:jvircam
文件:Camera.java
public Point2i getResolution() {
return resolution;
}
项目:asura-j
文件:GotoReadyPositionTask.java
public void continueTask(StrategyContext context) {
WorldObject self = context.getSelf();
Role currentRole = context.getRole();
boolean isKickoff = context.getKickOffTeam() == context.getTeam();
Point2i target = ReadyPosition
.getTargetPosition(currentRole, isKickoff);
float dist = MathUtils.distance(self.getX(), self.getY(), target.x,
target.y);
float deg = MathUtils.normalizeAngle180(MathUtils.toDegrees(MathUtils
.atan2(target.x - self.getX(), target.y - self.getY()))
- self.getYaw());
tracking.setMode(BallTrackingTask.Mode.Localize);
log.trace("sx:" + self.getX() + " sy:" + self.getY() + " sh:"
+ self.getYaw() + " tx:" + target.x + " ty:" + target.y);
// 移動できてるか
if (Math.abs(self.getX() - target.x) > 200
|| Math.abs(self.getY() - target.y) > 200) {
// 移動する
if (deg < -20) {
if (context.hasMotion(NAOJI_WALKER))
context.makemotion(NAOJI_WALKER, 0, 0, 0.75f * MathUtils
.toRadians(deg));
else
context.makemotion(MOTION_RIGHT_YY_TURN);
} else if (deg > 20) {
if (context.hasMotion(NAOJI_WALKER))
context.makemotion(NAOJI_WALKER, 0, 0, 0.75f * MathUtils
.toRadians(deg));
else
context.makemotion(MOTION_LEFT_YY_TURN);
} else {
if (context.hasMotion(NAOJI_WALKER))
context.makemotion(NAOJI_WALKER, dist * 0.25f / 1e3f, 0, 0);
else
context.makemotion(MOTION_YY_FORWARD);
}
} else {
// 大体目標位置
// 方向が正面か
float heading = self.getYaw();
if (Math.abs(heading) > 20) {
// 0に近づける
if (heading > 0) {
if (context.hasMotion(NAOJI_WALKER))
context.makemotion(NAOJI_WALKER, 0, 0,
0.75f * MathUtils.toRadians(heading));
else
context.makemotion(MOTION_RIGHT_YY_TURN);
} else {
if (context.hasMotion(NAOJI_WALKER))
context.makemotion(NAOJI_WALKER, 0, 0,
0.75f * MathUtils.toRadians(heading));
else
context.makemotion(MOTION_LEFT_YY_TURN);
}
} else {
// 移動終わり
context.makemotion(NULL);
context.getScheduler().abort();
return;
}
}
super.continueTask(context);
}
项目:asura-j
文件:MathUtils.java
/**
* @param world
* @param world2
* @return
*/
public static float distance(Point2i p1, Point2i p2) {
return distance(p1.x, p1.y, p2.x, p2.y);
}