ModraUp Ruby API Documentation Ruby API Reference

Class: ModraUp::Vertex

Inherits:
ModraUp::Entity show all

Overview

Vertices. Vertex#position with topological queries (edge/faces/rings, Vertex#used_by?). The parent class is ModraUp::Entity, not ModraUp::Drawingelement.

Examples:

e = ModraUp.active_model.entities.add_line([0, 0, 0], [1, 0, 0])
e.start.position.to_a  #=> [0.0, 0.0, 0.0]

Instance Method Summary # collapse

Inherited from ModraUp::Entity

Instance Method Details

vertex.position ⇒ Geom::Point3d

Vertex coordinates.

Returns:

  • (Geom::Point3d)

Examples:

e = ModraUp.active_model.entities.add_line([0, 0, 0], [1, 0, 0])
e.start.position.to_a  #=> [0.0, 0.0, 0.0]

vertex.common_edge(vertex2) ⇒ ModraUp::Edge, nil

Edge between two points.

Parameters:

  • vertex2 (ModraUp::Vertex)

Returns:

  • (ModraUp::Edge, nil)

Examples:

e = ModraUp.active_model.entities.add_line([0, 0, 0], [1, 0, 0])
e.start.common_edge(e.end) == e

vertex.curve_interior? ⇒ ModraUp::ArcCurve, nil

If the vertex is inside the curve (not an open arc endpoint), return the ModraUp::ArcCurve.

Returns:

  • (ModraUp::ArcCurve, nil)

Examples:

ModraUp.active_model.entities.add_circle([0, 0, 0], [0, 0, 1], 5)[0].start.curve_interior?

vertex.edges ⇒ Array<ModraUp::Edge>

Return the edges that use this vertex.

Returns:

  • (Array<ModraUp::Edge>)

Examples:

ModraUp.active_model.entities.add_line([0, 0, 0], [1, 0, 0]).start.edges.length >= 1

vertex.faces ⇒ Array<ModraUp::Face>

Returns the faces that use this vertex.

Returns:

  • (Array<ModraUp::Face>)

Examples:

f = ModraUp.active_model.entities.add_face([0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0])
f.vertices[0].faces.include?(f)

vertex.loops ⇒ Array<ModraUp::Loop>

Loops that pass through this vertex.

Returns:

  • (Array<ModraUp::Loop>)

Examples:

f = ModraUp.active_model.entities.add_face([0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0])
f.vertices[0].loops[0].face == f

vertex.used_by?(face_or_edge) ⇒ Boolean

Does the vertex used by a given edge or face.

Parameters:

  • face_or_edge (ModraUp::Edge, ModraUp::Face)

Returns:

  • (Boolean)

Examples:

e = ModraUp.active_model.entities.add_line([0, 0, 0], [1, 0, 0])
e.start.used_by?(e)