Android Canvas。(Android Canvas. Moving and Rotating Bitmap along Circular Path based on Touch?)
是否可以根据触摸事件沿圆形路径移动和旋转图像,如下所示:
我看过这个问题: 基于Android中的触摸事件以圆周运动移动图像但是它只告诉我如何沿着圆圈移动图像,而不是旋转它。
Is it Possible to move and rotate an Image along a Circular Path based on a touch event as follows:
I have looked at this question: Moving an Image in circular motion based on touch events in android But it only tells me how to move the image along a circle, not rotate it.
原文:https://stackoverflow.com/questions/25708276
最满意答案
这取决于......使用
functions
,不可能有两个不同的函数结果。 但是,您可以从函数返回一个长度为2的数组。function myfunc(x, y) implicit none integer, intent(in) :: x,y integer :: myfunc(2) myfunc = [ 2*x, 3*y ] end function
如果需要两个返回值到两个不同的变量,请使用
subroutine
:subroutine myfunc(x, y, a, b) implicit none integer, intent(in) :: x,y integer, intent(out):: a,b a = 2*x b = 3*y end subroutine
That depends... With
functions
, it is not possible to have two distinct function results. However, you can have an array of length two returned from the function.function myfunc(x, y) implicit none integer, intent(in) :: x,y integer :: myfunc(2) myfunc = [ 2*x, 3*y ] end function
If you need two return values to two distinct variables, use a
subroutine
instead:subroutine myfunc(x, y, a, b) implicit none integer, intent(in) :: x,y integer, intent(out):: a,b a = 2*x b = 3*y end subroutine
相关问答
更多-
外部两个循环可以用一个ddply调用替换,而内部一个循环用第二个循环替换。 我保留了tmp2和tmp3名称,以显示它们在原始代码中对应的内容。 library("plyr") bDf <- ddply(aDf, .(year, sic2), function(tmp2) { medRos <- median(tmp2$ros) medTat <- median(tmp2$tat) ddply(tmp2, .(gvkey), function(tmp3) { Advantage(tmp3$ ...
-
你接近解决方案。 您的F1返回2个值,但如果您直接输入F2参数,F2将在输入中看到 (y,z) <--- tuple q <--- variable 一种解决方案是将F1的返回值存储到2个变量中,然后将它们传递给F2 y,z = F1(x) F2(y,z,q) 另一种解决方案是使用*args首先传递q,然后使用y和z def F2(q, *args): y, z = *args some other code def F1(x): some code return y, ...
-
返回多个值的函数(Function which returns multiple values)[2021-09-12]
这取决于......使用functions ,不可能有两个不同的函数结果。 但是,您可以从函数返回一个长度为2的数组。 function myfunc(x, y) implicit none integer, intent(in) :: x,y integer :: myfunc(2) myfunc = [ 2*x, 3*y ] end function 如果需要两个返回值到两个不同的变量,请使用subroutine : subrout ... -
为了返回两个值,我使用一个std::pair (通常是typedef'd)。 你应该看看boost::tuple (在C ++ 11和更新的,有std::tuple )有两个以上的返回结果。 For returning two values I use a std::pair (usually typedef'd). You should look at boost::tuple (in C++11 and newer, there's std::tuple) for more than two retur ...
-
使用sorted有点奇怪。 您可以通过简单的if语句轻松替换它。 甚至更奇怪的是, cost只返回c作为返回元组的第二个值。 在mincost ,从不使用不是默认值的c值来调用cost ,因此c总是为0.0这使得排序非常冗余。 但我想有一些关于成本函数的缺失部分。 不过,您可以像这样实现它的功能: string MinCost (string alg) { List
parts = alg.split(" "); Tuple cost1 = C ... -
Python:如何从线程函数中获取多个返回值(Python: How to get multiple return values from a threaded function)[2022-06-20]
您应该使用queue从线程中检索数据,这里有一个示例使用包装器将函数中的值存储到队列中: import threading import queue my_queue = queue.Queue() def storeInQueue(f): def wrapper(*args): my_queue.put(f(*args)) return wrapper @storeInQueue def get_name(full_name): return full_name, full_ ... -
将多个值返回给函数,并在Lua中分别访问它们?(Return multiple values to a function, and access them separately in Lua?)[2022-06-01]
x, y, z= angles() print (x,y,z) x, y, z= angles() print (x,y,z) -
Python支持传递多个参数,并返回多个值。 也就是说,您可以将您的代码更改为: def func(w): return [h*c/i for i in w] 如果你现在调用它,你可以得到所需的数组: >>> w = [1 ,2, 3, 4] >>> func(w) [1239.8418743309974, 619.9209371654987, 413.2806247769991, 309.96046858274934] 至于使用多个参数调用并返回多个示例,请考虑以下示例方法,该方法需要2个输入 ...
-
Javascript没有从函数返回多个对象的概念。 相反,你必须建立一个本身包含这些值的对象: var returnObject = {}; if(age <= 0){ ('.age-alignment').addClass('error-border'); }else{ returnObject.age = age; }; if(resultFirstName){ returnObject.firstName = firstName; }else{ ...
-
Python:如何多线程化一个返回多个值的函数(Python: How to Multi-Thread a Function that Returns Multiple Values)[2022-08-18]
您可能希望稍微修改您的函数以使用Queue获取结果。 import threading, Queue def func1(queue): x = 2 y = 5 queue.put((x, y)) queue = Queue.Queue() new_thread = threading.Thread(target=func1, args=(queue, )) new_thread.start() new_thread.join() x, y = queue.get() You ...