Point3d
geometry :: IPoint3d :: defaultinit
geometry $ IPoint3d :: core_serialize_to
Actual serialization ofself
to serializer
geometry $ IPoint3d :: from_deserializer
Create an instance of this class from thedeserializer
serialization :: Serializable :: accept_json_serializer
Refinable service to customize the serialization of this class to JSONserialization :: Serializable :: accept_msgpack_attribute_counter
Hook to customize the behavior of theAttributeCounter
serialization :: Serializable :: accept_msgpack_serializer
Hook to customize the serialization of this class to MessagePackserialization :: Serializable :: add_to_bundle
Called by[]=
to dynamically choose the appropriate method according
core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
serialization :: Serializable :: core_serialize_to
Actual serialization ofself
to serializer
geometry :: IPoint :: defaultinit
geometry :: Boxed :: defaultinit
geometry :: Boxed3d :: defaultinit
core :: Object :: defaultinit
geometry :: IPoint3d :: defaultinit
serialization :: Serializable :: from_deserializer
Create an instance of this class from thedeserializer
geometry :: Boxed :: intersects
Doesself
intersect with other
?
core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
serialization :: Serializable :: msgpack_extra_array_items
Hook to request a larger than usual metadata arraycore :: Object :: output_class_name
Display class name on stdout (debug only).serialization :: Serializable :: serialize_msgpack
Serializeself
to MessagePack bytes
serialization :: Serializable :: serialize_to
Serializeself
to serializer
serialization :: Serializable :: serialize_to_json
Serializeself
to JSON
serialization :: Serializable :: to_pretty_json
Serializeself
to plain pretty JSON
Serializer::serialize
# Abstract 3d point, strongly linked to its implementation `Point3d`
interface IPoint3d[N: Numeric]
super IPoint[N]
# Depth coordinate
fun z: N is abstract
redef fun to_s do return "({x}, {y}, {z})"
redef fun dist2(other)
do return x.value_of(other.dist2_with_3d(self))
redef fun dist2_with_2d(other)
do return dist2_xy(other).add(z.mul(z))
redef fun dist2_with_3d(other)
do
var dz = other.z.sub(z)
var s = dist2_xy(other).add(dz.mul(dz))
return x.value_of(s)
end
# Get a new `Point3d[Float]` at an offset of `x, y, z` from `self`
#
# ~~~
# var origin = new Point3d[Float](1.0, 1.0, 1.0)
# assert origin.offset(1.0, 2.0, 3.0).to_s == "(2.0, 3.0, 4.0)"
# ~~~
fun offset(x, y, z: Numeric): Point3d[Float]
do return new Point3d[Float](self.x.to_f+x.to_f,
self.y.to_f+y.to_f,
self.z.to_f+z.to_f)
end
lib/geometry/points_and_lines.nit:124,1--156,3