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


Java Vector2D.ZERO属性代码示例

本文整理汇总了Java中org.apache.commons.math3.geometry.euclidean.twod.Vector2D.ZERO属性的典型用法代码示例。如果您正苦于以下问题:Java Vector2D.ZERO属性的具体用法?Java Vector2D.ZERO怎么用?Java Vector2D.ZERO使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.commons.math3.geometry.euclidean.twod.Vector2D的用法示例。


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

示例1: drawBack

public static Face drawBack(
	MeshModel model,
	double minX, double minY, double minZ,
	double maxX, double maxY, double maxZ,
	Optional<Texture> texture) {

	Vector2D minUV;
	Vector2D maxUV;

	if (texture.isPresent()) {
		minUV = texture.get().minUV;
		maxUV = texture.get().maxUV;
	} else {
		minUV = Vector2D.ZERO;
		maxUV = Vector2DUtil.ONE;
	}

	Face back = new Face();
	back.texture = texture;
	back.normal = Direction.NORTH.toVector();
	//Top-left corner
	back.drawVertex(new Vertex(minX, maxY, minZ, maxUV.getX(), maxUV.getY()));
	//Top-right corner
	back.drawVertex(new Vertex(maxX, maxY, minZ, minUV.getX(), maxUV.getY()));
	//Bottom-right corner
	back.drawVertex(new Vertex(maxX, minY, minZ, minUV.getX(), minUV.getY()));
	//Bottom-left corner
	back.drawVertex(new Vertex(minX, minY, minZ, maxUV.getX(), minUV.getY()));
	model.drawFace(back);

	return back;
}
 
开发者ID:NOVA-Team,项目名称:NOVA-Core,代码行数:32,代码来源:ItemRenderPipeline.java

示例2: drawFront

public static Face drawFront(
	MeshModel model,
	double minX, double minY, double minZ,
	double maxX, double maxY, double maxZ,
	Optional<Texture> texture) {

	Vector2D minUV;
	Vector2D maxUV;

	if (texture.isPresent()) {
		minUV = texture.get().minUV;
		maxUV = texture.get().maxUV;
	} else {
		minUV = Vector2D.ZERO;
		maxUV = Vector2DUtil.ONE;
	}

	Face front = new Face();
	front.texture = texture;
	front.normal = Direction.SOUTH.toVector();
	//Bottom-left corner
	front.drawVertex(new Vertex(minX, minY, maxZ, maxUV.getX(), minUV.getY()));
	//Bottom-right corner
	front.drawVertex(new Vertex(maxX, minY, maxZ, minUV.getX(), minUV.getY()));
	//Top-right corner
	front.drawVertex(new Vertex(maxX, maxY, maxZ, minUV.getX(), maxUV.getY()));
	//Top-left corner
	front.drawVertex(new Vertex(minX, maxY, maxZ, maxUV.getX(), maxUV.getY()));
	model.drawFace(front);

	return front;
}
 
开发者ID:NOVA-Team,项目名称:NOVA-Core,代码行数:32,代码来源:ItemRenderPipeline.java

示例3: getTexVec

private Vector2D getTexVec(int index) {
	try {
		return textureCoordinates.get(index < 0 ? index + textureCoordinates.size() : index - 1);
	} catch (IndexOutOfBoundsException e) {
		System.err.println("[OBJ]: Can't get textureCoordinate " + index + "! Is this model corrupted?");
		return Vector2D.ZERO;
	}
}
 
开发者ID:NOVA-Team,项目名称:NOVA-Core,代码行数:8,代码来源:WavefrontObjectModelProvider.java

示例4: Texture

@SuppressWarnings("deprecation")
public Texture(String domain, String name) {
	super(domain, name);
	this.dimension = Vector2DUtil.ONE;
	this.minUV = Vector2DUtil.ONE;
	this.maxUV = Vector2D.ZERO;
}
 
开发者ID:NOVA-Team,项目名称:NOVA-Core,代码行数:7,代码来源:Texture.java

示例5: Background

public Background(Texture texture, EnumFill xFill, EnumFill yFill) {
	this(texture, xFill, yFill, new RelativePosition(Vector2D.ZERO));
}
 
开发者ID:NOVA-Team,项目名称:NOVA-GUI,代码行数:3,代码来源:Background.java

示例6: getMinimumSize

default Vector2D getMinimumSize(GuiComponent<?, ?> component) {
	return Vector2D.ZERO;
}
 
开发者ID:NOVA-Team,项目名称:NOVA-GUI,代码行数:3,代码来源:GuiLayout.java

示例7: getPreferredSizeOf

protected final Vector2D getPreferredSizeOf(GuiComponent<?, ?> component) {
	return component != null ? component.getPreferredSize().orElse(component.getMinimumSize().orElse(Vector2D.ZERO)) : Vector2D.ZERO;
}
 
开发者ID:NOVA-Team,项目名称:NOVA-GUI,代码行数:3,代码来源:AbstractGuiLayout.java

示例8: getMaximumSizeOf

protected final Vector2D getMaximumSizeOf(GuiComponent<?, ?> component) {
	return component != null ? component.getPreferredSize().orElse(component.getMaximumSize().orElse(Vector2DUtil.ONE)) : Vector2D.ZERO;
}
 
开发者ID:NOVA-Team,项目名称:NOVA-GUI,代码行数:3,代码来源:AbstractGuiLayout.java

示例9: getMiniumSizeOf

protected final Vector2D getMiniumSizeOf(GuiComponent<?, ?> component) {
	return component != null ? component.getMinimumSize().orElse(Vector2D.ZERO) : Vector2D.ZERO;
}
 
开发者ID:NOVA-Team,项目名称:NOVA-GUI,代码行数:3,代码来源:AbstractGuiLayout.java

示例10: quadToFace

@SuppressWarnings("unchecked")
public Face quadToFace(BakedQuad quad) {
	Face face = new Face();
	final VertexFormat format = this.format; // 1.11.2 stores VertexFormat on a per-quad basis.

	int[] data = quad.getVertexData();
	Optional<TextureAtlasSprite> texture = Optional.ofNullable(wrapped.getTexture());

	final Optional<VertexFormatElement> posElement = ((Collection<VertexFormatElement>)format.getElements()).stream()
		.filter(VertexFormatElement::isPositionElement)
		.findFirst();

	final Optional<VertexFormatElement> uvElement = ((Collection<VertexFormatElement>)format.getElements()).stream()
		.filter(vfe -> vfe.getUsage() == VertexFormatElement.EnumUsage.UV)
		.findFirst();

	face.texture = texture
		.filter(t -> uvElement.isPresent())
		.map(TextureAtlasSprite::getIconName)
		.map(ResourceLocation::new)
		.map(AssetConverter.instance()::toNovaTexture);

	// `VertexFormat` offsets are for a `ByteBuffer`
	// `data` is an int array, so we convert the offsets

	// TODO: support offsets which are not divisible by four
	final int posOffset = posElement.map(VertexFormatElement::getOffset).map(i -> i / 4).orElse(-1);
	final int uvOffset = uvElement.map(VertexFormatElement::getOffset).map(i -> i / 4).orElse(-1);
	final int colorOffset = format.hasColor() ? (format.getColorOffset() / 4) : -1;
	final int normalOffset = format.hasNormal() ? (format.getNormalOffset() / 4) : -1;

	for (int i = 0; i < data.length; i += 7) {
		Vector3D pos = posElement.isPresent() ? new Vector3D(
			Float.intBitsToFloat(data[i + posOffset]),
			Float.intBitsToFloat(data[i + posOffset + 1]),
			Float.intBitsToFloat(data[i + posOffset + 2])) : Vector3D.ZERO;

		Vector2D uv = uvElement.isPresent() ? new Vector2D(
			deinterpolateU(Float.intBitsToFloat(data[i + uvOffset]), texture),
			deinterpolateV(Float.intBitsToFloat(data[i + uvOffset + 1]), texture)) : Vector2D.ZERO;

		Vertex vertex = new Vertex(pos, uv);
		if (format.hasColor()) {
			if (DefaultVertexFormats.BLOCK.equals(format))
				vertex.color = Color.argb(data[i + colorOffset]);
			else
				vertex.color = Color.rgba(data[i + colorOffset]);
		}

		Optional<Vector3D> normal = Optional.empty();
		if (format.hasNormal()) {
			int mergedNormal = data[i + normalOffset];
			if (mergedNormal != 0)
				normal = Optional.of(new Vector3D(((byte)(mergedNormal & 0xFF)) / 127D,
					((byte)((mergedNormal >> 8) & 0xFF)) / 127D,
					((byte)((mergedNormal >> 16) & 0xFF)) / 127D));
		}

		if (format.hasNormal())
			vertex.normal = normal;
		face.drawVertex(vertex);
	}
	face.normal = Vector3DUtil.calculateNormal(face);
	return face;
}
 
开发者ID:NOVA-Team,项目名称:NOVA-Core,代码行数:65,代码来源:BWBakedModel.java


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