/** * Set the X and Y coordinate of the point. * * @param x X coordinate of the point. * @param y Y coordinate of the point. */ public void setXY(double x, double y) { _touch(); if (m_attributes == null) _setToDefault(); m_attributes[0] = x; m_attributes[1] = y; }
/** * Sets the value of the attribute. * * @param semantics The attribute semantics. * @param ordinate The ordinate of the attribute. * @param value Is the array to write values to. The attribute type and the number of elements * must match the persistence type, as well as the number of components of the attribute. */ public void setAttribute(int semantics, int ordinate, double value) { _touch(); int ncomps = VertexDescription.getComponentCount(semantics); if (ncomps < ordinate) throw new IndexOutOfBoundsException(); int attributeIndex = m_description.getAttributeIndex(semantics); if (attributeIndex < 0) { addAttribute(semantics); attributeIndex = m_description.getAttributeIndex(semantics); } if (m_attributes == null) _setToDefault(); m_attributes[m_description._getPointAttributeOffset(attributeIndex) + ordinate] = value; }
/** * Sets the XYZ coordinates of this point. * * @param pt The point to create the XYZ coordinate from. */ void setXYZ(Point3D pt) { _touch(); boolean bHasZ = hasAttribute(Semantics.Z); if (!bHasZ && !VertexDescription.isDefaultValue(Semantics.Z, pt.z)) { // add // Z // only // if // pt.z // is // not // a // default // value. addAttribute(Semantics.Z); bHasZ = true; } if (m_attributes == null) _setToDefault(); m_attributes[0] = pt.x; m_attributes[1] = pt.y; if (bHasZ) m_attributes[2] = pt.z; }